# Anthropic messages Source: https://docs.nordlyslabs.com/api-reference/anthropic-messages openapi.yaml post /v1/messages Anthropic Messages API with NordlysProxy routing. # Chat completions Source: https://docs.nordlyslabs.com/api-reference/chat-completions openapi.yaml post /v1/chat/completions OpenAI-compatible chat completions with NordlysProxy routing. # Gemini generate content (v1beta) Source: https://docs.nordlyslabs.com/api-reference/gemini-generate-content-v1beta openapi.yaml post /v1beta/models/{model}:generateContent Google-style endpoint that takes model from the path. # Gemini stream generate content (v1beta) Source: https://docs.nordlyslabs.com/api-reference/gemini-stream-generate-content-v1beta openapi.yaml post /v1beta/models/{model}:streamGenerateContent Google-style streaming endpoint that takes model from the path. # Get model Source: https://docs.nordlyslabs.com/api-reference/get-model openapi.yaml get /v1/models/{id} Fetch a model from the registry by ID. # List models Source: https://docs.nordlyslabs.com/api-reference/list-models openapi.yaml get /v1/models List models from the registry with optional filters. # Claude Code Integration Source: https://docs.nordlyslabs.com/developer-tools/claude-code Set up Claude Code with Nordlys's advanced AI model Nordlys model for intelligent model selection Configure Claude Code to use Nordlys's Mixture of Models — our Mixture of Models automatically selects the best specialist while maintaining the same development experience. **Get the best AI specialist for every prompt** with Nordlys Mixture of Models. Works as a drop-in replacement for the Claude API. ## Get Your Nordlys API Key [Sign up here](https://www.nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ```bash macOS/Linux theme={null} curl -o claude-code.sh https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/claude-code.sh chmod +x claude-code.sh ./claude-code.sh ``` ```powershell Windows (PowerShell) theme={null} iwr https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/claude-code.ps1 -OutFile claude-code.ps1; Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass; .\claude-code.ps1 ``` ```bat Windows (cmd) theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/claude-code.cmd -o claude-code.cmd claude-code.cmd ``` ```bash theme={null} claude ``` Select "Yes" when prompted about using the API key. Ask "who are you?" to confirm Hypernova is active. Claude Code working with Hypernova ## Alternative Setup Methods ```bash Environment Variables theme={null} export ANTHROPIC_BASE_URL=https://api.nordlyslabs.com export ANTHROPIC_AUTH_TOKEN=your-nordlys-api-key export ANTHROPIC_MODEL=nordlys/hypernova export ANTHROPIC_SMALL_FAST_MODEL=nordlys/hypernova # Manual model overrides (override all for complete control) export ANTHROPIC_DEFAULT_OPUS_MODEL=nordlys/hypernova # Model for opus, or opusplan when Plan Mode is active export ANTHROPIC_DEFAULT_SONNET_MODEL=nordlys/hypernova # Model for sonnet, or opusplan when Plan Mode is not active export ANTHROPIC_DEFAULT_HAIKU_MODEL=nordlys/hypernova # Model for haiku, or background functionality export CLAUDE_CODE_SUBAGENT_MODEL=nordlys/hypernova # Model for subagents ``` ```powershell Environment Variables (PowerShell) theme={null} $env:ANTHROPIC_BASE_URL="https://api.nordlyslabs.com" $env:ANTHROPIC_AUTH_TOKEN="your-nordlys-api-key" $env:ANTHROPIC_MODEL="nordlys/hypernova" $env:ANTHROPIC_SMALL_FAST_MODEL="nordlys/hypernova" $env:ANTHROPIC_DEFAULT_OPUS_MODEL="nordlys/hypernova" $env:ANTHROPIC_DEFAULT_SONNET_MODEL="nordlys/hypernova" $env:ANTHROPIC_DEFAULT_HAIKU_MODEL="nordlys/hypernova" $env:CLAUDE_CODE_SUBAGENT_MODEL="nordlys/hypernova" setx ANTHROPIC_AUTH_TOKEN "your-nordlys-api-key" ``` ```json Manual Settings File theme={null} { "env": { "ANTHROPIC_AUTH_TOKEN": "your-nordlys-api-key", "ANTHROPIC_BASE_URL": "https://api.nordlyslabs.com", "ANTHROPIC_MODEL": "nordlys/hypernova", "ANTHROPIC_SMALL_FAST_MODEL": "nordlys/hypernova", "ANTHROPIC_DEFAULT_OPUS_MODEL": "nordlys/hypernova", "ANTHROPIC_DEFAULT_SONNET_MODEL": "nordlys/hypernova", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "nordlys/hypernova", "CLAUDE_CODE_SUBAGENT_MODEL": "nordlys/hypernova" } } ``` ```bash CI/Automation theme={null} export NORDLYS_API_KEY='your-api-key' curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/claude-code.sh | bash ``` ```powershell CI/Automation (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key" setx NORDLYS_API_KEY "your-api-key" iwr https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/claude-code.ps1 -OutFile claude-code.ps1; Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass; .\claude-code.ps1 ``` ```bat CI/Automation (cmd) theme={null} set NORDLYS_API_KEY=your-api-key curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/claude-code.cmd -o claude-code.cmd claude-code.cmd ``` ## Troubleshooting * Verify your API key at [nordlyslabs.com/api-platform/orgs](https://www.nordlyslabs.com/api-platform/orgs) * Check that `ANTHROPIC_BASE_URL` is set to `https://api.nordlyslabs.com/v1` * Restart Claude Code after configuration changes * Regenerate your API key from the Nordlys dashboard * Ensure you're using your Nordlys API key, not the original Claude API key * Check for extra spaces or characters in the configuration file ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Integrate Nordlys into your applications and workflows Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Claude Code integration. # Cline Integration Source: https://docs.nordlyslabs.com/developer-tools/cline Set up Cline VS Code extension with Nordlys's advanced AI model Nordlys model for intelligent model selection Configure Cline VS Code extension to use Nordlys's Mixture of Models — our Mixture of Models automatically selects the best specialist while maintaining the same AI-assisted development experience. **Get the best AI specialist for every prompt** with Nordlys Mixture of Models. Works as a drop-in replacement in your favorite VS Code AI assistant. ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup Open VS Code Extensions Marketplace, search for "Cline", and click **Install**. Search for Cline in VS Code Extensions Marketplace When prompted, click **"Trust Publisher & Install"** to confirm the installation. Trust Cline publisher dialog Click the Cline icon in the sidebar, then select **"Use your own API key"**. Cline welcome screen with Use your own API key button In the Settings panel, configure the following: 1. **API Provider**: OpenAI Compatible 2. **Base URL**: `https://api.nordlyslabs.com/v1` 3. **API Key**: your-nordlys-api-key ([get it here](https://nordlyslabs.com/api-platform/orgs)) 4. **Model ID**: `nordlys/hypernova` Cline API settings configuration Test Cline with a simple prompt to confirm it's connected to Nordlys. Cline working with Nordlys Hypernova ## Configuration Details ```text OpenAI API Configuration theme={null} API Provider: OpenAI Compatible Base URL: https://api.nordlyslabs.com/v1 API Key: your-nordlys-api-key Model ID: nordlys/hypernova ``` ## Alternative Setup Methods ```json Settings File theme={null} // In VS Code settings.json { "cline.provider": "openai-compatible", "cline.baseUrl": "https://api.nordlyslabs.com/v1", "cline.apiKey": "your-nordlys-api-key", "cline.model": "nordlys/hypernova" } ``` ```bash Environment Variables theme={null} export OPENAI_BASE_URL=https://api.nordlyslabs.com/v1 export OPENAI_API_KEY=your-nordlys-api-key ``` ```powershell Environment Variables (PowerShell) theme={null} $env:OPENAI_BASE_URL="https://api.nordlyslabs.com/v1" $env:OPENAI_API_KEY="your-nordlys-api-key" setx OPENAI_BASE_URL "https://api.nordlyslabs.com/v1" setx OPENAI_API_KEY "your-nordlys-api-key" ``` ```text Manual Configuration theme={null} 1. Open Cline settings in VS Code 2. Set API Provider to "OpenAI Compatible" 3. Enter Base URL, API key, and Model ID as shown above ``` ## Troubleshooting * Verify your API key at [nordlyslabs.com/api-platform/orgs](https://nordlyslabs.com/api-platform/orgs) * Check that Base URL is set to `https://api.nordlyslabs.com/v1` * Restart VS Code after configuration changes * Use `nordlys/hypernova` for Mixture of Models (recommended) * Specific models: `claude-sonnet-4-5`, `gpt-4.1-nano`, `gpt-5-mini` * Test connection with a simple request after setup ## Next Steps Track your usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other AI development tools with Nordlys integration Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Cline integration. # OpenAI Codex Integration Source: https://docs.nordlyslabs.com/developer-tools/codex Configure OpenAI Codex with Nordlys's advanced AI model Nordlys model for intelligent model selection Configure OpenAI Codex to use Nordlys's Mixture of Models — our Mixture of Models automatically selects the best specialist while maintaining the same AI-powered coding experience. **Get the best AI specialist for every prompt** with Nordlys Mixture of Models. Works as a drop-in replacement for OpenAI Codex API. ## Get Your Nordlys API Key [Sign up here](https://www.nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ```bash macOS/Linux theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/codex.sh | bash ``` ```powershell Windows (PowerShell) theme={null} iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/codex.ps1 | iex ``` ```bat Windows (cmd) theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/codex.cmd -o codex.cmd codex.cmd ``` The installer will handle configuration and environment setup automatically. ```bash theme={null} codex --version echo $NORDLYS_API_KEY ``` ```bash theme={null} codex -m nordlys/hypernova ``` Codex CLI running with Nordlys ## Alternative Setup Methods ```bash Environment Variables theme={null} export NORDLYS_API_KEY='your-api-key-here' curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/codex.sh | bash ``` ```powershell Environment Variables (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key-here" setx NORDLYS_API_KEY "your-api-key-here" iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/codex.ps1 | iex ``` ```bat Environment Variables (cmd) theme={null} set NORDLYS_API_KEY=your-api-key-here curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/codex.cmd -o codex.cmd codex.cmd ``` ```toml Manual Configuration theme={null} # Edit ~/.codex/config.toml model = "nordlys/hypernova" model_provider = "nordlys" [model_providers.nordlys] name = "Nordlys" base_url = "https://api.nordlyslabs.com/v1" env_key = "NORDLYS_API_KEY" wire_api = "responses" ``` ```bash Interactive Install theme={null} curl -o codex.sh https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/codex.sh chmod +x codex.sh ./codex.sh ``` ## Troubleshooting * Check installation method availability (npm, brew, cargo, curl) * Verify system dependencies are installed * Try the interactive installation method for better error handling * Verify API key at [nordlyslabs.com/api-platform/orgs](https://www.nordlyslabs.com/api-platform/orgs) * Check that `NORDLYS_API_KEY` environment variable is set * Restart terminal or run `source ~/.bashrc` after installation ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other CLI tools with Nordlys integration Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Codex integration. # Cursor Integration Source: https://docs.nordlyslabs.com/developer-tools/cursor Set up Cursor IDE with Nordlys's Mixture of Models model for lab-grade quality and lower cost Configure Cursor IDE to use Nordlys's Mixture of Models model for high-quality coding assistance. **Get the best AI specialist for every prompt** with a Mixture of Models model. Works as a drop-in replacement in Cursor IDE. ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup Download and install Cursor IDE from the official website. [Download Cursor](https://cursor.com/download) Click the settings icon (⚙️) in the top-right corner of Cursor to open Settings. Open Cursor Settings In the left sidebar, click on **Models** to view available AI models. Navigate to Models section Click **+ Add Custom Model** and enter `nordlys/hypernova` as the model name. Enable the toggle to activate it. Add Nordlys Custom Model Expand the **API Keys** section and configure the following: 1. Enable the **OpenAI API Key** toggle 2. Enter your Nordlys API key ([get it here](https://nordlyslabs.com/api-platform/orgs)) 3. Enable **Override OpenAI Base URL** 4. Enter the base URL: ```text theme={null} https://api.nordlyslabs.com/v1 ``` Configure API Keys and Base URL Close settings and start using Cursor with the Nordlys model. Cursor successfully configured with Nordlys ## Configuration Details ```text OpenAI API Configuration theme={null} Model: nordlys/hypernova OpenAI API Key: your-nordlys-api-key Override OpenAI Base URL: https://api.nordlyslabs.com/v1 ``` ## Features with Nordlys * **Mixture of Models Activation**: The right specialists activate per prompt * **Cost Optimization**: Intelligent model selection for better value * **Same Experience**: No changes to your Cursor workflow * **Real-time Analytics**: Track usage and savings in the Nordlys dashboard ## Troubleshooting * Verify your API key at [nordlyslabs.com/api-platform/orgs](https://nordlyslabs.com/api-platform/orgs) * Check that Base URL is set to `https://api.nordlyslabs.com/v1` * Restart Cursor after configuration changes * Ensure the API Key toggle is enabled * Add `nordlys/hypernova` as a custom model using **+ Add Custom Model** * Ensure the model toggle is enabled after adding * Test with a simple code completion request after setup * Regenerate your API key from the Nordlys dashboard if needed * Ensure you're using your Nordlys API key, not OpenAI/Anthropic keys * Check for extra spaces or characters in the API key field * Verify the Base URL override is properly enabled ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other AI development tools with Nordlys integration Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Cursor integration. # Gemini CLI Integration Source: https://docs.nordlyslabs.com/developer-tools/gemini-cli Configure Gemini CLI with Nordlys's Mixture of Models model for lab-grade quality and lower cost Configure Gemini CLI to use Nordlys's Mixture of Models model. **Mixture of Models model** with prompt‑activated specialists. Works as a drop-in replacement for Gemini CLI's API backend with lab-grade quality and cost control. ## Benefits of Using Gemini CLI with Nordlys When you integrate Gemini CLI with Nordlys, you unlock powerful capabilities: * **Mixture of Models Activation**: The right specialists activate per prompt * **Cost Optimization**: Lower costs without sacrificing quality * **Consistent Quality**: Stable outputs across coding tasks * **Usage Analytics**: Monitor model usage, costs, and performance in real-time * **Simplified Configuration**: Single API key for all Gemini model variants ## Get Your Nordlys API Key [Sign up here](https://www.nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ```bash macOS/Linux theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/gemini-cli.sh | bash ``` ```powershell Windows (PowerShell) theme={null} iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/gemini-cli.ps1 | iex ``` ```bat Windows (cmd) theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/gemini-cli.cmd -o gemini-cli.cmd gemini-cli.cmd ``` The installer will automatically: * Install Gemini CLI if not present (via npm) * Configure environment variables for Nordlys Nordlys model * Add configuration to your shell profile (\~/.bashrc, \~/.zshrc, etc.) * Verify the installation ```bash theme={null} gemini --version echo $GEMINI_API_KEY echo $GOOGLE_GEMINI_BASE_URL ``` ```bash theme={null} gemini ``` Nordlys will activate the right specialists for the task. Gemini CLI successfully configured with Nordlys ## Manual Installation If you prefer to set up Gemini CLI manually or need more control over the installation process: ### Step 1: Install Gemini CLI ```bash theme={null} npm install -g @google/gemini-cli ``` ### Step 2: Configure Environment Variables ```bash Bash/Zsh (~/.bashrc or ~/.zshrc) theme={null} # Gemini CLI with Nordlys AI model API Configuration export GEMINI_API_KEY="your-nordlys-api-key-here" export GOOGLE_GEMINI_BASE_URL="https://api.nordlyslabs.com/v1beta" ``` ```fish Fish Shell (~/.config/fish/config.fish) theme={null} # Gemini CLI with Nordlys AI model API Configuration set -x GEMINI_API_KEY "your-nordlys-api-key-here" set -x GOOGLE_GEMINI_BASE_URL "https://api.nordlyslabs.com/v1beta" ``` ```powershell Windows (PowerShell) theme={null} $env:GEMINI_API_KEY="your-nordlys-api-key-here" $env:GOOGLE_GEMINI_BASE_URL="https://api.nordlyslabs.com/v1beta" setx GEMINI_API_KEY "your-nordlys-api-key-here" setx GOOGLE_GEMINI_BASE_URL "https://api.nordlyslabs.com/v1beta" ``` ### Step 3: Apply Configuration ```bash theme={null} # For Bash/Zsh source ~/.bashrc # or ~/.zshrc # For Fish source ~/.config/fish/config.fish # Or restart your terminal ``` ### Step 4: Verify Installation ```bash theme={null} gemini --version gemini ``` ## Alternative Setup Methods ```bash Environment Variable Method theme={null} export NORDLYS_API_KEY='your-api-key-here' curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/gemini-cli.sh | bash # The installer will automatically configure your shell ``` ```powershell Environment Variable Method (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key-here" setx NORDLYS_API_KEY "your-api-key-here" iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/gemini-cli.ps1 | iex ``` ```bat Environment Variable Method (cmd) theme={null} set NORDLYS_API_KEY=your-api-key-here curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/gemini-cli.cmd -o gemini-cli.cmd gemini-cli.cmd ``` ```bash Interactive Installation theme={null} curl -o gemini-cli.sh https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/gemini-cli.sh chmod +x gemini-cli.sh ./gemini-cli.sh # Follow the interactive prompts ``` ## Advanced Configuration ### Model Selection Set the model ID explicitly when needed: ```bash Nordlys Model (Recommended) theme={null} export GEMINI_MODEL='nordlys/hypernova' gemini "analyze this codebase" ``` ## Usage Examples ```bash Interactive Chat theme={null} # Start interactive chat session gemini # Or with a specific prompt gemini "help me debug this code" ``` ```bash Code Assistance theme={null} # Generate code gemini "create a React component for user authentication" # Explain code gemini "explain how async/await works in JavaScript" # Debug code gemini "why is my Python script throwing a TypeError?" ``` ```bash Quick Tasks theme={null} # Get quick answers gemini "what's the difference between let and const?" # Generate documentation gemini "write documentation for this API endpoint" # Code review gemini "review this function for potential bugs" ``` ## Troubleshooting **Problem**: Gemini CLI installation fails **Solutions**: * Ensure Node.js 18+ is installed: `node --version` * Install Node.js if needed: ```bash theme={null} # Using nvm (recommended) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash nvm install 22 ``` * Check npm permissions: `npm config get prefix` * Try with sudo (not recommended): `sudo npm install -g @google/gemini-cli` **Problem**: "Unauthorized" or "Invalid API key" errors **Solutions**: 1. Verify your API key at [nordlyslabs.com/api-platform/orgs](https://www.nordlyslabs.com/api-platform/orgs) 2. Check environment variables are set: ```bash theme={null} echo $GEMINI_API_KEY echo $GOOGLE_GEMINI_BASE_URL ``` 3. Ensure variables are exported in your shell config: ```bash theme={null} # Bash/Zsh source ~/.bashrc # or ~/.zshrc # Fish source ~/.config/fish/config.fish ``` 4. Restart your terminal if changes were made to shell config 5. Verify the base URL is correct: `https://api.nordlyslabs.com/v1` **Problem**: Cannot connect to Nordlys API **Solutions**: * Check internet connectivity * Verify base URL is correct: `echo $GOOGLE_GEMINI_BASE_URL` * Test API directly: ```bash theme={null} curl -X POST https://api.nordlyslabs.com/v1/chat/completions \ -H "Authorization: Bearer $GEMINI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nordlys/hypernova", "messages": [{"role": "user", "content": "Hello"}] }' ``` * Check if your network/firewall blocks the API endpoint **Problem**: Requests fail due to a model ID error **Solutions**: 1. Set the model ID explicitly: ```bash theme={null} export GEMINI_MODEL='nordlys/hypernova' ``` 2. Confirm the value is spelled exactly and matches the docs. **Problem**: Slow response times or timeouts **Solutions**: * Verify rate limits aren't exceeded * Check your internet connection speed * Reduce prompt size or request complexity ## Uninstallation If you need to remove Gemini CLI or revert to Google's API: ```bash theme={null} npm uninstall -g @google/gemini-cli ``` Edit your shell config file and remove these lines: ```bash theme={null} # Gemini CLI with Nordlys AI model API Configuration export GEMINI_API_KEY="..." export GOOGLE_GEMINI_BASE_URL="..." ``` ```bash theme={null} source ~/.bashrc # or ~/.zshrc or ~/.config/fish/config.fish ``` ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other CLI tools with Nordlys integration Learn about Nordlys Mixture of Models and load balancing *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Gemini CLI integration. # Grok CLI Integration Source: https://docs.nordlyslabs.com/developer-tools/grok-cli Configure Grok CLI with Nordlys's advanced AI model Nordlys model for intelligent model selection Configure Grok CLI to use Nordlys's Mixture of Models — our Mixture of Models automatically selects the best specialist while maintaining the same AI-powered command line experience. **Get the best AI specialist for every prompt** with Nordlys Mixture of Models. Works as a drop-in replacement for Grok CLI's API backend. The installer automatically configures your shell environment. ## Get Your Nordlys API Key [Sign up here](https://www.nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ```bash macOS/Linux theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/grok-cli.sh | bash ``` ```powershell Windows (PowerShell) theme={null} iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/grok-cli.ps1 | iex ``` The installer will prompt you for your Nordlys API key and automatically: * Install Grok CLI if not present * Configure Nordlys API settings * Add environment variables to your shell config Close and reopen your terminal to load the new environment variables, or run: ```bash theme={null} source ~/.zshrc # or ~/.bashrc for Bash users ``` ```bash theme={null} grok -m nordlys/hypernova ``` Grok CLI running with Hypernova model ## Alternative Setup Methods ```bash Environment Variables theme={null} export NORDLYS_API_KEY='your-api-key-here' curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/grok-cli.sh | bash # The installer will automatically add the API key to your shell config ``` ```json Configuration File theme={null} { "apiKey": "your-nordlys-api-key", "baseURL": "https://api.nordlyslabs.com/v1", "defaultModel": "nordlys/hypernova" } ``` ```bash Create Configuration File theme={null} mkdir -p ~/.grok cat > ~/.grok/user-settings.json << 'EOF' { "apiKey": "your-nordlys-api-key", "baseURL": "https://api.nordlyslabs.com/v1", "defaultModel": "nordlys/hypernova" } EOF ``` ```bash Environment Variables (Bash/Zsh) theme={null} echo 'export NORDLYS_API_KEY="your-nordlys-api-key"' >> ~/.bashrc echo 'export NORDLYS_BASE_URL="https://api.nordlyslabs.com/v1"' >> ~/.bashrc # For zsh users, use ~/.zshrc instead of ~/.bashrc ``` ```fish Environment Variables (Fish Shell) theme={null} echo 'set -x NORDLYS_API_KEY "your-nordlys-api-key"' >> ~/.config/fish/config.fish echo 'set -x NORDLYS_BASE_URL "https://api.nordlyslabs.com/v1"' >> ~/.config/fish/config.fish ``` ```powershell Windows (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-nordlys-api-key" $env:NORDLYS_BASE_URL="https://api.nordlyslabs.com/v1" setx NORDLYS_API_KEY "your-nordlys-api-key" setx NORDLYS_BASE_URL "https://api.nordlyslabs.com/v1" ``` ```bash Interactive Install theme={null} curl -o grok-cli.sh https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/grok-cli.sh chmod +x grok-cli.sh ./grok-cli.sh # Follow the interactive prompts - environment variables will be added automatically ``` ## Advanced Configuration The installer automatically handles environment variable setup for all major shells (bash, zsh, fish). Manual configuration is typically not needed. ### Shell-Specific Configuration ```bash Bash (~/.bashrc) theme={null} # Nordlys AI model API Configuration export NORDLYS_API_KEY="your-nordlys-api-key" export NORDLYS_BASE_URL="https://api.nordlyslabs.com/v1" ``` ```zsh Zsh (~/.zshrc) theme={null} # Nordlys AI model API Configuration export NORDLYS_API_KEY="your-nordlys-api-key" export NORDLYS_BASE_URL="https://api.nordlyslabs.com/v1" ``` ```fish Fish (~/.config/fish/config.fish) theme={null} # Nordlys AI model API Configuration set -x NORDLYS_API_KEY "your-nordlys-api-key" set -x NORDLYS_BASE_URL "https://api.nordlyslabs.com/v1" ``` ```powershell Windows (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-nordlys-api-key" $env:NORDLYS_BASE_URL="https://api.nordlyslabs.com/v1" setx NORDLYS_API_KEY "your-nordlys-api-key" setx NORDLYS_BASE_URL "https://api.nordlyslabs.com/v1" ``` ## Troubleshooting If you see an error like: ``` Grok API error: 400 invalid model 'grok-4-latest': only nordlys/* models are supported ``` This means Grok CLI is trying to use a model that isn't supported by the Nordlys API. Fix it by: 1. **Update your configuration file** to only use `nordlys/hypernova`: ```bash theme={null} cat > ~/.grok/user-settings.json << 'EOF' { "apiKey": "your-nordlys-api-key", "baseURL": "https://api.nordlyslabs.com/v1", "defaultModel": "nordlys/hypernova", "models": ["nordlys/hypernova"] } EOF ``` 2. **Set the GROK\_MODEL environment variable** to override any other settings: ```bash theme={null} # Add to your shell config (~/.bashrc, ~/.zshrc, etc.) export GROK_MODEL="nordlys/hypernova" export GROK_BASE_URL="https://api.nordlyslabs.com/v1" ``` 3. **Re-run the installer** to automatically fix the configuration: ```bash theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/grok-cli.sh | bash ``` * Ensure you have the required dependencies (Node.js, Python, etc.) * Check installation logs for specific error messages * Try the interactive installation method for better error handling * Verify your API key at [nordlyslabs.com/api-platform/orgs](https://www.nordlyslabs.com/api-platform/orgs) * Check that API key is properly set in `~/.grok/user-settings.json` * Ensure environment variables are exported in your shell config: ```bash theme={null} # Check if variables are set echo $NORDLYS_API_KEY echo $NORDLYS_BASE_URL # If not set, restart terminal or source your shell config source ~/.bashrc # or ~/.zshrc for Zsh users ``` ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other CLI tools with Nordlys integration Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Grok CLI integration. # Kilo Code Integration Source: https://docs.nordlyslabs.com/developer-tools/kilo-code Configure Kilo Code with Nordlys's advanced AI model for intelligent model selection Configure Kilo Code to use Nordlys's Mixture of Models for intelligent model selection in VS Code. **Get the best AI specialist for every prompt** with Nordlys Mixture of Models. Works seamlessly with Kilo Code's development features. ## Get Your Nordlys API Key [Sign up here](https://www.nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup Open VS Code Extensions (`Cmd+Shift+X` / `Ctrl+Shift+X`), search for **"kilocode"**, and click **Install**. Search and install Kilo Code from VS Code Extensions Click **"Trust Publisher & Install"** when prompted. Trust the Kilo Code publisher On the welcome screen, click **"Use your own API key"** to configure Nordlys. Select Use your own API key In the Settings panel, configure: * **API Provider**: `OpenAI Compatible` * **Base URL**: `https://api.nordlyslabs.com/v1` * **API Key**: Your Nordlys API key * **Model**: `nordlys/hypernova` Click **Save** when done. Configure Nordlys API settings Hypernova is now active. Start a new task to verify the setup. Kilo Code working with Hypernova ## Configuring MCP (Optional) Kilo Code supports MCP (Model Context Protocol) to extend AI capabilities. Add MCP servers in Settings > MCP Servers: ```json theme={null} { "mcpServers": { "filesystem": { "command": "npx", "args": [ "@modelcontextprotocol/server-filesystem", "/path/to/your/project" ] } } } ``` ## Alternative Setup Methods ```bash Environment Variables theme={null} export OPENAI_BASE_URL=https://api.nordlyslabs.com/v1 export OPENAI_API_KEY=your-nordlys-api-key # Then launch Kilo Code from terminal ``` ```powershell Environment Variables (PowerShell) theme={null} $env:OPENAI_BASE_URL="https://api.nordlyslabs.com/v1" $env:OPENAI_API_KEY="your-nordlys-api-key" setx OPENAI_BASE_URL "https://api.nordlyslabs.com/v1" setx OPENAI_API_KEY "your-nordlys-api-key" # Then launch Kilo Code from terminal ``` ```json Configuration File theme={null} // In kilo-code settings.json { "kiloCode": { "apiProvider": "openai-compatible", "baseUrl": "https://api.nordlyslabs.com/v1", "apiKey": "your-nordlys-api-key", "model": "gpt-4.1-nano" } } ``` ```text Manual Configuration theme={null} 1. Open VS Code settings (Ctrl/Cmd + ,) 2. Search for "Kilo Code" 3. Set API Provider to "OpenAI Compatible" 4. Enter Base URL: https://api.nordlyslabs.com/v1 5. Enter your Nordlys API key 6. Select your preferred model ``` ## Troubleshooting * Verify your API key at [nordlyslabs.com/api-platform/orgs](https://www.nordlyslabs.com/api-platform/orgs) * Check that Base URL is set to `https://api.nordlyslabs.com/v1` * Restart Kilo Code after configuration changes * Ensure environment variables are properly set * Verify configuration file syntax if using file-based config * Test connection with a simple request after setup ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Set up Nordlys with other AI development tools Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Kilo Code integration. # OpenCode Integration Source: https://docs.nordlyslabs.com/developer-tools/opencode Configure OpenCode to use Nordlys's Mixture of Models model for lab-grade coding quality and lower cost Configure OpenCode to use Nordlys's Mixture of Models model for high-quality coding results. **Get the best AI specialist for every prompt** with a Mixture of Models model. Works as a custom integration in OpenCode. ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ```bash macOS/Linux theme={null} curl -o opencode.sh https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/opencode.sh chmod +x opencode.sh ``` ```powershell Windows (PowerShell) theme={null} Invoke-WebRequest -Uri https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/opencode.ps1 -OutFile opencode.ps1 ``` ```bash macOS/Linux theme={null} ./opencode.sh ``` ```powershell Windows (PowerShell) theme={null} .\opencode.ps1 ``` The installer will prompt for your API key and configure OpenCode with Nordlys. Config is saved to `~/.config/opencode/opencode.json`. Start OpenCode and run `/models`, then select **"Hypernova Nordlys"**. Select Hypernova Nordlys model in OpenCode Hypernova is now active. Start chatting to verify the setup. OpenCode working with Hypernova ## Alternative Setup Methods ```bash Environment Variables theme={null} export NORDLYS_API_KEY='your-api-key-here' ./opencode.sh ``` ```powershell Environment Variables (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key-here" .\opencode.ps1 ``` ```json Manual Configuration theme={null} // Create ~/.config/opencode/opencode.json { "$schema": "https://opencode.ai/config.json", "provider": { "nordlys": { "npm": "@ai-sdk/openai-compatible", "name": "Nordlys", "options": { "baseURL": "https://api.nordlyslabs.com/v1", "apiKey": "your-nordlys-api-key" }, "models": { "nordlys/hypernova": { "name": "Hypernova" } } } }, "model": "nordlys/hypernova" } ``` ## Troubleshooting * Check `opencode.json` syntax is valid JSON * Ensure integration ID "nordlys" matches between auth and config * Run `opencode auth list` to confirm credentials were added * Regenerate API key from [Nordlys dashboard](https://nordlyslabs.com/api-platform/orgs) * Verify integration ID matches exactly between auth and config * Try re-running `opencode auth login` and selecting "Other" ## Next Steps Track your usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Set up Nordlys with Claude Code, Cline, and other AI development tools Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your OpenCode integration. # Qwen Code Integration Source: https://docs.nordlyslabs.com/developer-tools/qwen-code Configure Qwen Code with Nordlys's Mixture of Models model for lab-grade coding quality and lower cost Configure Qwen Code to use Nordlys's Mixture of Models model for coding tasks. **Mixture of Models model** with prompt‑activated specialists. Works as a drop-in replacement for Qwen Code's API backend with lab-grade quality and cost control. ## Benefits of Using Qwen Code with Nordlys When you integrate Qwen Code with Nordlys, you unlock powerful capabilities: * **Mixture of Models Activation**: The right specialists activate per prompt * **Cost Optimization**: Optimize API costs with lab‑tuned models * **Consistent Quality**: Stable output quality across coding tasks * **Drop-in Integration**: OpenAI-compatible settings with zero code changes * **Usage Analytics**: Monitor model usage, costs, and performance in real-time ## Get Your Nordlys API Key [Sign up here](https://www.nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ```bash macOS/Linux theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/qwen-code.sh | bash ``` ```powershell Windows (PowerShell) theme={null} iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/qwen-code.ps1 | iex ``` ```bat Windows (cmd) theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/qwen-code.cmd -o qwen-code.cmd qwen-code.cmd ``` The installer will automatically: * Install Qwen Code if not present (via npm) * Configure OpenAI-compatible environment variables for Nordlys * Add configuration to your shell profile (\~/.bashrc, \~/.zshrc, etc.) * Verify the installation ```bash theme={null} qwen --version echo $OPENAI_API_KEY echo $OPENAI_BASE_URL ``` ```bash theme={null} qwen ``` Qwen Code configured with Nordlys ## Manual Installation If you prefer to set up Qwen Code manually or need more control over the installation process: ### Step 1: Install Qwen Code ```bash theme={null} npm install -g @qwen-code/qwen-code@latest ``` Qwen Code requires Node.js 20 or higher. Check your version with `node --version`. ### Step 2: Configure Environment Variables Qwen Code uses OpenAI-compatible API configuration: ```bash Bash/Zsh (~/.bashrc or ~/.zshrc) theme={null} # Qwen Code with Nordlys AI model API Configuration export OPENAI_API_KEY="your-nordlys-api-key-here" # qwen-code export OPENAI_BASE_URL="https://api.nordlyslabs.com/v1" # qwen-code export OPENAI_MODEL="nordlys/hypernova" # qwen-code - for automatic Nordlys model ``` ```fish Fish Shell (~/.config/fish/config.fish) theme={null} # Qwen Code with Nordlys AI model API Configuration set -x OPENAI_API_KEY "your-nordlys-api-key-here" # qwen-code set -x OPENAI_BASE_URL "https://api.nordlyslabs.com/v1" # qwen-code set -x OPENAI_MODEL "nordlys/hypernova" # qwen-code - for automatic Nordlys model ``` ```powershell Windows (PowerShell) theme={null} $env:OPENAI_API_KEY="your-nordlys-api-key-here" $env:OPENAI_BASE_URL="https://api.nordlyslabs.com/v1" $env:OPENAI_MODEL="nordlys/hypernova" setx OPENAI_API_KEY "your-nordlys-api-key-here" setx OPENAI_BASE_URL "https://api.nordlyslabs.com/v1" setx OPENAI_MODEL "nordlys/hypernova" ``` ### Step 3: Apply Configuration ```bash theme={null} # For Bash/Zsh source ~/.bashrc # or ~/.zshrc # For Fish source ~/.config/fish/config.fish # Or restart your terminal ``` ### Step 4: Verify Installation ```bash theme={null} qwen --version qwen ``` ## Alternative Setup Methods ```bash Environment Variable Method theme={null} export NORDLYS_API_KEY='your-api-key-here' curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/qwen-code.sh | bash # The installer will automatically configure your shell ``` ```powershell Environment Variable Method (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key-here" setx NORDLYS_API_KEY "your-api-key-here" iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/qwen-code.ps1 | iex ``` ```bat Environment Variable Method (cmd) theme={null} set NORDLYS_API_KEY=your-api-key-here curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/qwen-code.cmd -o qwen-code.cmd qwen-code.cmd ``` ```bash Interactive Installation theme={null} curl -o qwen-code.sh https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/qwen-code.sh chmod +x qwen-code.sh ./qwen-code.sh # Follow the interactive prompts ``` ```bash Custom Model Configuration theme={null} export NORDLYS_API_KEY='your-api-key-here' export OPENAI_MODEL='nordlys/hypernova' # Optional: specify default model curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/qwen-code.sh | bash ``` ```powershell Custom Model Configuration (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key-here" $env:OPENAI_MODEL="nordlys/hypernova" setx NORDLYS_API_KEY "your-api-key-here" setx OPENAI_MODEL "nordlys/hypernova" iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/qwen-code.ps1 | iex ``` ```bat Custom Model Configuration (cmd) theme={null} set NORDLYS_API_KEY=your-api-key-here set OPENAI_MODEL=nordlys/hypernova curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/qwen-code.cmd -o qwen-code.cmd qwen-code.cmd ``` ## Troubleshooting **Problem**: Qwen Code installation fails **Solutions**: * Ensure Node.js 20+ is installed: `node --version` * Install Node.js if needed: ```bash theme={null} # Using nvm (recommended) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash nvm install 22 ``` * Check npm permissions: `npm config get prefix` * Try with sudo (not recommended): `sudo npm install -g @qwen-code/qwen-code` * Clear npm cache: `npm cache clean --force` **Problem**: "Unauthorized" or "Invalid API key" errors **Solutions**: 1. Verify your API key at [nordlyslabs.com/api-platform/orgs](https://www.nordlyslabs.com/api-platform/orgs) 2. Check environment variables are set: ```bash theme={null} echo $OPENAI_API_KEY echo $OPENAI_BASE_URL echo $OPENAI_MODEL ``` 3. Ensure variables are exported in your shell config: ```bash theme={null} # Bash/Zsh source ~/.bashrc # or ~/.zshrc # Fish source ~/.config/fish/config.fish ``` 4. Restart your terminal if changes were made to shell config 5. Verify the base URL is correct: `https://api.nordlyslabs.com/v1` 6. Check for the `# qwen-code` comment to ensure correct environment variables **Problem**: Cannot connect to Nordlys API **Solutions**: * Check internet connectivity * Verify base URL is correct: `echo $OPENAI_BASE_URL` * Test API directly: ```bash theme={null} curl -X POST https://api.nordlyslabs.com/v1/chat/completions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nordlys/hypernova", "messages": [{"role": "user", "content": "Hello"}] }' ``` * Check if your network/firewall blocks the API endpoint * Try using a different network or VPN **Problem**: Requests fail due to a model ID error **Solutions**: 1. Set the model ID explicitly: ```bash theme={null} export OPENAI_MODEL='nordlys/hypernova' ``` 2. Confirm the value is spelled exactly and matches the docs. **Problem**: Slow response times or timeouts **Solutions**: * Verify rate limits aren't exceeded * Check your network connection * Reduce prompt size or request complexity * Retry with smaller batches if processing large files ## Uninstallation If you need to remove Qwen Code or revert configuration: ```bash theme={null} npm uninstall -g @qwen-code/qwen-code ``` Edit your shell config file and remove these lines: ```bash theme={null} # Qwen Code with Nordlys AI model API Configuration export OPENAI_API_KEY="..." # qwen-code export OPENAI_BASE_URL="..." # qwen-code export OPENAI_MODEL="..." # qwen-code ``` ```bash theme={null} source ~/.bashrc # or ~/.zshrc or ~/.config/fish/config.fish ``` ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other CLI tools with Nordlys integration Learn about Nordlys Mixture of Models and load balancing *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Qwen Code integration. # Roo Code Integration Source: https://docs.nordlyslabs.com/developer-tools/roo-code Configure Roo Code with Nordlys's advanced AI model for intelligent model selection Configure Roo Code to use Nordlys's Mixture of Models for intelligent model selection in VS Code. **Get the best AI specialist for every prompt** with Nordlys Mixture of Models. Works seamlessly with Roo Code's development features. ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup Open VS Code Extensions (`Cmd+Shift+X` / `Ctrl+Shift+X`), search for **"roocode"**, and click **Install**. Search and install Roo Code from VS Code Extensions Click **"Trust Publisher & Install"** when prompted. Trust the Roo Code publisher On the welcome screen, click **"or use without an account"** to configure with your own API key. Select use without an account option Select **"3rd-party Provider"** and configure: * **API Provider**: `OpenAI Compatible` * **Base URL**: `https://api.nordlyslabs.com/v1` * **API Key**: Your Nordlys API key * **Model**: `nordlys/hypernova` Configure Nordlys API settings Hypernova is now active. Start chatting to verify the setup. Roo Code working with Hypernova ## Alternative Setup Methods ```json Settings File theme={null} // In VS Code settings.json { "rooCode.provider": "openai-compatible", "rooCode.baseUrl": "https://api.nordlyslabs.com/v1", "rooCode.apiKey": "your-nordlys-api-key", "rooCode.model": "nordlys/hypernova" } ``` ```bash Environment Variables theme={null} export OPENAI_BASE_URL=https://api.nordlyslabs.com/v1 export OPENAI_API_KEY=your-nordlys-api-key # Then launch VS Code from terminal ``` ```powershell Environment Variables (PowerShell) theme={null} $env:OPENAI_BASE_URL="https://api.nordlyslabs.com/v1" $env:OPENAI_API_KEY="your-nordlys-api-key" setx OPENAI_BASE_URL "https://api.nordlyslabs.com/v1" setx OPENAI_API_KEY "your-nordlys-api-key" # Then launch VS Code from terminal ``` ```text Manual Configuration theme={null} 1. Open VS Code settings (Ctrl/Cmd + ,) 2. Search for "Roo Code" 3. Set API Provider to "OpenAI Compatible" 4. Enter Base URL: https://api.nordlyslabs.com/v1 5. Enter your Nordlys API key 6. Enter model: nordlys/hypernova ``` ## Troubleshooting * Verify your API key at [nordlyslabs.com/api-platform/orgs](https://nordlyslabs.com/api-platform/orgs) * Check that Base URL is set to `https://api.nordlyslabs.com/v1` * Restart VS Code after configuration changes * Ensure project is properly opened in VS Code workspace * Use `nordlys/hypernova` as the model for intelligent selection * Test with a simple analysis task after setup ## Next Steps Track your usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other AI development tools with Nordlys integration Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Roo Code integration. # Zed Editor Integration Source: https://docs.nordlyslabs.com/developer-tools/zed Configure Zed Editor with Nordlys's Mixture of Models model for lab-grade coding quality and lower cost Configure Zed Editor to use Nordlys's Mixture of Models model for high-quality AI-assisted coding. **Get the best AI specialist for every prompt** with a Mixture of Models model. Works as an OpenAI-compatible provider in Zed Editor. ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ```bash macOS/Linux theme={null} curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/zed.sh | bash ``` ```powershell Windows (PowerShell) theme={null} iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/zed.ps1 | iex ``` The installer will automatically: * Check if Zed is installed * Configure OpenAI-compatible provider with Nordlys * Backup existing settings * Add environment variables to your shell profile Close and restart Zed Editor to load the new configuration. Open the Agent Panel using: * **macOS**: `Cmd + Shift + A` * **Windows/Linux**: `Ctrl + Shift + A` Or via Command Palette: `agent: toggle` In the Agent Panel: 1. Click the model dropdown 2. Look for **"Nordlys"** section 3. Select **"Hypernova"** You're now using Nordlys Mixture of Models! ## Manual Installation If you prefer to configure Zed manually: ### Step 1: Locate Settings File ```bash macOS/Linux theme={null} ~/.config/zed/settings.json ``` ```powershell Windows theme={null} %APPDATA%\Zed\settings.json ``` ### Step 2: Add Nordlys Configuration Open your `settings.json` and add the Nordlys provider configuration: ```json theme={null} { "language_models": { "openai_compatible": { "Nordlys": { "api_url": "https://api.nordlyslabs.com/v1", "available_models": [ { "name": "nordlys/hypernova", "display_name": "Hypernova", "max_tokens": 200000, "capabilities": { "tools": true, "images": true, "parallel_tool_calls": true, "prompt_cache_key": false } } ] } } }, "agent": { "default_model": { "provider": "openai_compatible", "model": "nordlys/hypernova", "name": "Nordlys" } } } ``` ### Step 3: Set API Key Add your Nordlys API key as an environment variable: ```bash macOS/Linux (.bashrc or .zshrc) theme={null} export NORDLYS_API_KEY="your-api-key-here" ``` ```powershell Windows (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key-here" setx NORDLYS_API_KEY "your-api-key-here" ``` Restart your terminal and Zed Editor. ## Alternative Setup Methods ```bash Environment Variables (Unix) theme={null} export NORDLYS_API_KEY='your-api-key-here' curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/zed.sh | bash ``` ```powershell Environment Variables (PowerShell) theme={null} $env:NORDLYS_API_KEY="your-api-key-here" setx NORDLYS_API_KEY "your-api-key-here" iwr -useb https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/windows/zed.ps1 | iex ``` ```bash Interactive Install (Unix) theme={null} curl -o zed.sh https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/zed.sh chmod +x zed.sh ./zed.sh ``` ## Features with Nordlys The right specialists activate per prompt for optimal results Intelligent model selection for better value and performance Full support for function calling and tool use Process and analyze images in your conversations ## Agent Panel Profiles Zed's Agent Panel supports different interaction profiles: * **Ask**: Query-focused interactions for quick questions * **Write**: Generate code, documentation, and content * **Minimal**: Lightweight interactions with minimal context All profiles work seamlessly with Nordlys models. ## Troubleshooting * Verify `settings.json` syntax is valid (check for missing commas, brackets) * Ensure Zed has been fully restarted after configuration * Check that the `language_models` section is at the root level of your JSON * Review Zed's log output: `zed: open log` * Verify your API key at [nordlyslabs.com/api-platform/orgs](https://nordlyslabs.com/api-platform/orgs) * Ensure `NORDLYS_API_KEY` environment variable is set * Restart your terminal and Zed after setting the environment variable * Check the environment variable is loaded: `echo $NORDLYS_API_KEY` (Unix) or `$env:NORDLYS_API_KEY` (PowerShell) * Check that `api_url` is set to `https://api.nordlyslabs.com/v1` * Verify network connectivity to api.nordlyslabs.com * Check for proxy settings that might interfere * Review error messages in Zed's log: `zed: open log` * Ensure Zed is installed: visit [zed.dev](https://zed.dev) * Check that Python 3 is available (required by installer) * Manually backup your settings before running the installer * Try manual configuration if the installer fails ## Advanced Configuration ### Custom Model Parameters You can customize model parameters by modifying the `available_models` section: ```json theme={null} { "language_models": { "openai_compatible": { "Nordlys": { "api_url": "https://api.nordlyslabs.com/v1", "available_models": [ { "name": "nordlys/hypernova", "display_name": "Hypernova (Custom)", "max_tokens": 200000, "max_output_tokens": 8192, "capabilities": { "tools": true, "images": true, "parallel_tool_calls": true } } ] } } } } ``` ### Multiple Provider Configuration You can configure multiple OpenAI-compatible providers: ```json theme={null} { "language_models": { "openai_compatible": { "Nordlys": { "api_url": "https://api.nordlyslabs.com/v1", "available_models": [/* ... */] }, "Another Provider": { "api_url": "https://api.example.com/v1", "available_models": [/* ... */] } } } } ``` ## Next Steps Track your cost savings and usage analytics in real-time Learn about Nordlys's API capabilities and advanced features Explore other AI development tools with Nordlys integration Troubleshooting guides and support resources *** **Was this page helpful?** Contact us at [info@llmadaptive.uk](mailto:info@llmadaptive.uk) for feedback or assistance with your Zed integration. # Introduction Source: https://docs.nordlyslabs.com/index Welcome to Nordlys - a model-first AI lab building a Mixture of Models model. # The Model-First AI Lab Nordlys delivers a single Mixture of Models model: a lab-built system that activates the right models per prompt and behaves like one. ✨ **Drop-in OpenAI replacement** with zero code changes required ## Why Choose Nordlys? A lab-built Mixture of Models model with consistent behavior across tasks. Drop-in replacement for OpenAI API. Simply change your base URL and everything works immediately. Built on a research pipeline that continuously evaluates and improves Nordlys models. Built for scale with production-grade monitoring and analytics. ## How Nordlys Works Choose a Nordlys model—or use the default—to align tone, quality, and latency goals Nordlys activates a subset of models per prompt and composes a single response Receive consistent OpenAI-compatible responses with stable formatting and behavior Models improve over time as Nordlys learns what quality looks like for your use case ## Platform Capabilities Each Nordlys model delivers a distinct behavior while keeping one API surface. Control spend without sacrificing quality by choosing the model that fits the job. Lightning-fast response times with optimized model activation. Comprehensive monitoring and insights into usage patterns and performance metrics. ## Research-Grade Foundation Nordlys is built on frontier research and best‑in‑class model systems, shaped into one experience. New capabilities appear automatically in Nordlys models without integration changes. ## Get Started in Minutes Follow our step-by-step guide to integrate Nordlys into your application in under 5 minutes. Explore available models and pricing details. ## Popular Integrations Use with official OpenAI SDK for JavaScript, Python, and other languages Stream responses and build AI chat applications with Vercel AI SDK Integrate with LangChain workflows and chains for complex AI applications ## What Makes Nordlys Different Response metadata highlights quality and latency signals for each request. All responses follow OpenAI format standards, ensuring seamless compatibility with existing tools and workflows. Additional insights and performance metrics help you optimize your AI usage. ## Explore the Platform Learn how to use Nordlys model IDs and view pricing. See real-world examples and implementation patterns *** ## Ready to experience Nordlys model? Join thousands of developers who have already upgraded to a model‑first AI lab experience. Start using Nordlys today with your free tier - no credit card required # CrewAI Source: https://docs.nordlyslabs.com/integrations/crewai Integrate Nordlys with CrewAI for Nordlys model in multi-agent AI systems ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ### Installation ```bash pip theme={null} pip install crewai crewai-tools ``` ```bash uv theme={null} uv add crewai crewai-tools ``` ```bash poetry theme={null} poetry add crewai crewai-tools ``` ### Basic Integration ```python theme={null} from crewai import Agent, Task, Crew, AI model # Configure Nordlys AI model llm = AI model( model="", api_key="your-nordlys-api-key", base_url="https://api.nordlyslabs.com/v1" ) # Create agents researcher = Agent( role='Researcher', goal='Research and gather information', backstory='A thorough researcher with attention to detail', llm=llm ) writer = Agent( role='Writer', goal='Create engaging content based on research', backstory='A creative writer who transforms data into stories', llm=llm ) # Define tasks research_task = Task( description='Research the latest trends in AI technology', agent=researcher, expected_output='A comprehensive report on AI trends' ) writing_task = Task( description='Write an article based on the research findings', agent=writer, expected_output='A well-written article about AI trends' ) # Create and run the crew crew = Crew( agents=[researcher, writer], tasks=[research_task, writing_task], verbose=True ) result = crew.kickoff() print(result) ``` ## Key Benefits * **Nordlys model** - Automatic Nordlys model for each agent interaction * **Cost optimization** - 30-70% cost reduction across agent executions * **Tool support** - Nordlys selects function-calling capable models automatically * **Multi-agent collaboration** - Optimized Nordlys model for each agent's specific needs ## Next Steps See complete working examples with multi-agent systems Explore all available options and parameters # LangChain Source: https://docs.nordlyslabs.com/integrations/langchain Connect LangChain with Nordlys for Nordlys model ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ### Installation ```bash pip theme={null} pip install langchain langchain-openai ``` ```bash uv theme={null} uv add langchain langchain-openai ``` ```bash poetry theme={null} poetry add langchain langchain-openai ``` ```bash npm theme={null} npm install langchain @langchain/openai ``` ```bash yarn theme={null} yarn add langchain @langchain/openai ``` ```bash pnpm theme={null} pnpm add langchain @langchain/openai ``` ```bash bun theme={null} bun add langchain @langchain/openai ``` ### Basic Usage ```python Python theme={null} from langchain_openai import ChatOpenAI llm = ChatOpenAI( api_key="your-nordlys-api-key", base_url="https://api.nordlyslabs.com/v1", model="" ) response = llm.invoke("Explain machine learning simply") print(response.content) ``` ```javascript JavaScript/Node.js theme={null} import { ChatOpenAI } from "@langchain/openai"; const llm = new ChatOpenAI({ apiKey: "your-nordlys-api-key", baseURL: "https://api.nordlyslabs.com/v1", model: "nordlys/hypernova" }); const response = await llm.invoke("Explain quantum computing"); console.log(response.content); ``` ## Streaming Example ```python Python theme={null} for chunk in llm.stream("Tell me a story about AI"): print(chunk.content, end="", flush=True) ``` ```javascript JavaScript theme={null} const stream = await llm.stream("Tell me a story about AI"); for await (const chunk of stream) { process.stdout.write(chunk.content); } ``` ## Key Features * **Drop-in replacement** - Works with existing LangChain code * **Nordlys model** - Automatic Nordlys model based on complexity * **Streaming support** - Real-time responses work seamlessly * **Chain compatibility** - All LangChain patterns work without changes ## Next Steps See complete working examples with LangChain Explore all available options and parameters # LangGraph Source: https://docs.nordlyslabs.com/integrations/langgraph Use Nordlys with LangGraph for Nordlys model in stateful AI agent workflows ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Overview LangGraph is a low-level orchestration framework for building stateful, multi-actor applications with AI models. By integrating Nordlys with LangGraph's `ChatOpenAI`, you get advanced Nordlys model while building complex agent workflows with graphs, state management, and tool integration. ## Key Benefits * **Keep existing workflows** - No changes to your LangGraph graph structure * **Nordlys model** - Automatic Nordlys model for each agent interaction * **Cost optimization** - 30-70% cost reduction across agent executions * **Stateful agents** - Works seamlessly with LangGraph's state management * **Tool support** - Nordlys selects function-calling capable models automatically * **Streaming support** - Real-time responses in agent workflows ## Installation ```bash pip theme={null} pip install langgraph langchain-openai ``` ```bash uv theme={null} uv add langgraph langchain-openai ``` ```bash poetry theme={null} poetry add langgraph langchain-openai ``` ```bash npm theme={null} npm install @langchain/core @langchain/langgraph @langchain/openai ``` ```bash yarn theme={null} yarn add @langchain/core @langchain/langgraph @langchain/openai ``` ```bash pnpm theme={null} pnpm add @langchain/core @langchain/langgraph @langchain/openai ``` ```bash bun theme={null} bun add @langchain/core @langchain/langgraph @langchain/openai ``` ## Basic Usage ### Initialize ChatOpenAI with Nordlys The only change needed is to point LangGraph's `ChatOpenAI` to Nordlys's endpoint: ```python Python theme={null} from langchain_openai import ChatOpenAI model = ChatOpenAI( api_key="your-nordlys-api-key", base_url="https://api.nordlyslabs.com/v1", model="nordlys/hypernova", temperature=0, ) ``` ```typescript TypeScript theme={null} import { ChatOpenAI } from "@langchain/openai"; const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", // Nordlys's endpoint }, modelName: "nordlys/hypernova", temperature: 0, }); ``` ### Simple Chatbot with StateGraph ```python Python theme={null} from langgraph.graph import StateGraph, MessagesState, START, END from langchain_openai import ChatOpenAI # Initialize model with Nordlys model = ChatOpenAI( api_key="your-nordlys-api-key", base_url="https://api.nordlyslabs.com/v1", model="nordlys/hypernova", temperature=0, ) # Define the chatbot function def call_model(state: MessagesState): response = model.invoke(state["messages"]) return {"messages": [response]} # Create the graph workflow = StateGraph(MessagesState) workflow.add_node("agent", call_model) workflow.add_edge(START, "agent") workflow.add_edge("agent", END) app = workflow.compile() # Use the chatbot result = app.invoke({ "messages": [{"role": "user", "content": "What is LangGraph?"}] }) print(result["messages"][-1].content) ``` ```typescript TypeScript theme={null} import { StateGraph, MessagesAnnotation } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; // Initialize model with Nordlys const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0, }); // Define the chatbot function async function callModel(state: typeof MessagesAnnotation.State) { const response = await model.invoke(state.messages); return { messages: [response] }; } // Create the graph const workflow = new StateGraph(MessagesAnnotation) .addNode("agent", callModel) .addEdge("__start__", "agent") .addEdge("agent", "__end__"); const app = workflow.compile(); // Use the chatbot const result = await app.invoke({ messages: [{ role: "user", content: "What is LangGraph?" }], }); console.log(result.messages[result.messages.length - 1].content); ``` ## Advanced Examples ### Agent with Tools Nordlys automatically selects models that support function calling when tools are detected: ```python Python theme={null} from langgraph.graph import StateGraph, MessagesState, START, END from langgraph.prebuilt import ToolNode from langchain_openai import ChatOpenAI from langchain_core.tools import tool # Define tools @tool def get_weather(location: str) -> str: """Get the current weather for a location.""" # Weather API call return f"Weather in {location}: 72°F, sunny" tools = [get_weather] # Initialize model with tools model = ChatOpenAI( api_key="your-nordlys-api-key", base_url="https://api.nordlyslabs.com/v1", model="nordlys/hypernova", temperature=0, ).bind_tools(tools) # Define the agent function def call_model(state: MessagesState): response = model.invoke(state["messages"]) return {"messages": [response]} # Model selection function def should_continue(state: MessagesState): messages = state["messages"] last_message = messages[-1] if last_message.tool_calls: return "tools" return END # Create the graph workflow = StateGraph(MessagesState) workflow.add_node("agent", call_model) workflow.add_node("tools", ToolNode(tools)) workflow.add_edge(START, "agent") workflow.add_conditional_edges("agent", should_continue, ["tools", END]) workflow.add_edge("tools", "agent") app = workflow.compile() # Use the agent result = app.invoke({ "messages": [{"role": "user", "content": "What's the weather in San Francisco?"}] }) ``` ```typescript TypeScript theme={null} import { StateGraph, MessagesAnnotation } from "@langchain/langgraph"; import { ToolNode } from "@langchain/langgraph/prebuilt"; import { ChatOpenAI } from "@langchain/openai"; import { tool } from "@langchain/core/tools"; import { z } from "zod"; // Define tools const weatherTool = tool( async ({ location }) => { // Weather API call return `Weather in ${location}: 72°F, sunny`; }, { name: "get_weather", description: "Get the current weather for a location", schema: z.object({ location: z.string().describe("The city name"), }), } ); const tools = [weatherTool]; // Initialize model with tools const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0, }).bindTools(tools); // Define the agent function async function callModel(state: typeof MessagesAnnotation.State) { const response = await model.invoke(state.messages); return { messages: [response] }; } // Model selection function function shouldContinue(state: typeof MessagesAnnotation.State) { const messages = state.messages; const lastMessage = messages[messages.length - 1]; if ( lastMessage && typeof lastMessage === "object" && "tool_calls" in lastMessage && Array.isArray(lastMessage.tool_calls) && lastMessage.tool_calls.length > 0 ) { return "tools"; } return "__end__"; } // Create the graph const workflow = new StateGraph(MessagesAnnotation) .addNode("agent", callModel) .addNode("tools", new ToolNode(tools)) .addEdge("__start__", "agent") .addConditionalEdges("agent", shouldContinue) .addEdge("tools", "agent"); const app = workflow.compile(); // Use the agent const result = await app.invoke({ messages: [{ role: "user", content: "What's the weather in San Francisco?" }], }); ``` ### Streaming Agent Responses ```typescript theme={null} import { StateGraph, MessagesAnnotation } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0, }); async function callModel(state: typeof MessagesAnnotation.State) { const response = await model.invoke(state.messages); return { messages: [response] }; } const workflow = new StateGraph(MessagesAnnotation) .addNode("agent", callModel) .addEdge("__start__", "agent") .addEdge("agent", "__end__"); const app = workflow.compile(); // Stream the agent's responses const stream = await app.stream({ messages: [{ role: "user", content: "Write a short poem about AI" }], }); for await (const chunk of stream) { if (chunk.agent && chunk.agent.messages) { const message = chunk.agent.messages[0]; if (message && message.content) { process.stdout.write(message.content); } } } ``` ### Multi-Agent Workflow ```typescript theme={null} import { StateGraph, Annotation } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; // Define custom state with multiple agents const WorkflowState = Annotation.Root({ messages: Annotation({ reducer: (x, y) => x.concat(y), }), currentAgent: Annotation({ reducer: (x, y) => y ?? x, default: () => "researcher", }), }); // Initialize different models for different agents const researcherModel = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0.3, }); const writerModel = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0.7, }); // Define agent nodes async function researcher(state: typeof WorkflowState.State) { const response = await researcherModel.invoke([ { role: "system", content: "You are a research specialist." }, ...state.messages, ]); return { messages: [response], currentAgent: "writer", }; } async function writer(state: typeof WorkflowState.State) { const response = await writerModel.invoke([ { role: "system", content: "You are a creative writer." }, ...state.messages, ]); return { messages: [response], currentAgent: "end", }; } // Model layer function function model layer(state: typeof WorkflowState.State) { return state.currentAgent === "writer" ? "writer" : "__end__"; } // Build the workflow const workflow = new StateGraph(WorkflowState) .addNode("researcher", researcher) .addNode("writer", writer) .addEdge("__start__", "researcher") .addConditionalEdges("researcher", model layer) .addEdge("writer", "__end__"); const app = workflow.compile(); // Execute multi-agent workflow const result = await app.invoke({ messages: [ { role: "user", content: "Research and write about quantum computing" }, ], }); ``` ## Integration Patterns ### With Memory/Checkpointing ```typescript theme={null} import { MemorySaver } from "@langchain/langgraph"; import { StateGraph, MessagesAnnotation } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0, }); async function callModel(state: typeof MessagesAnnotation.State) { const response = await model.invoke(state.messages); return { messages: [response] }; } const workflow = new StateGraph(MessagesAnnotation) .addNode("agent", callModel) .addEdge("__start__", "agent") .addEdge("agent", "__end__"); // Add memory for persistent conversations const memory = new MemorySaver(); const app = workflow.compile({ checkpointer: memory }); // Use with conversation threads const config = { configurable: { thread_id: "user-123" } }; // First message await app.invoke( { messages: [{ role: "user", content: "My name is Alice" }] }, config, ); // Follow-up message (remembers context) const result = await app.invoke( { messages: [{ role: "user", content: "What's my name?" }] }, config, ); ``` ### Human-in-the-Loop ```typescript theme={null} import { StateGraph, MessagesAnnotation } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; import { MemorySaver } from "@langchain/langgraph"; const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0, }); async function callModel(state: typeof MessagesAnnotation.State) { const response = await model.invoke(state.messages); return { messages: [response] }; } const workflow = new StateGraph(MessagesAnnotation) .addNode("agent", callModel) .addEdge("__start__", "agent") .addEdge("agent", "__end__"); // Compile with interrupt before agent node for human approval const memory = new MemorySaver(); const app = workflow.compile({ checkpointer: memory, interruptBefore: ["agent"], }); const config = { configurable: { thread_id: "conversation-1" } }; // Start the workflow (will pause before agent) await app.invoke( { messages: [{ role: "user", content: "Send an email to the team" }] }, config, ); // Get current state for human review const state = await app.getState(config); console.log("Pending action:", state.values); // Human approves and continues await app.invoke(null, config); ``` ## Configuration Options ### Model Selection Use the Nordlys model ID: ```typescript theme={null} modelName: "nordlys/hypernova"; ``` ### Temperature and Parameters All standard ChatOpenAI parameters work with Nordlys: ```typescript theme={null} const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", temperature: 0.7, maxTokens: 1000, topP: 1, frequencyPenalty: 0, presencePenalty: 0, }); ``` ## Best Practices 1. **Use `nordlys/hypernova`** across agent nodes 2. **Different temperatures** for different agents (research vs creative) 3. **Leverage checkpointing** for stateful conversations with memory 4. **Use conditional edges** for complex agent logic 5. **Add human-in-the-loop** for critical decisions with interrupt points 6. **Tool integration** - keep tool calls explicit and deterministic ## Error Handling Nordlys retries transient errors automatically. For comprehensive error handling patterns, see the [Error Handling Guide](/guides/error-handling). ```typescript theme={null} import { StateGraph, MessagesAnnotation } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; // Nordlys handles Nordlys model failures automatically const model = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1", }, modelName: "nordlys/hypernova", // Nordlys model with automatic retries temperature: 0, }); async function callModel(state: typeof MessagesAnnotation.State) { const response = await model.invoke(state.messages); return { messages: [response] }; } const workflow = new StateGraph(MessagesAnnotation) .addNode("agent", callModel) .addEdge("__start__", "agent") .addEdge("agent", "__end__"); const app = workflow.compile(); // Nordlys handles errors automatically - no try/catch needed for basic usage const result = await app.invoke({ messages: [{ role: "user", content: "Hello, how are you?" }], }); ``` *** ## Complete Example See the [complete LangGraph example](https://github.com/your-org/nordlys/blob/main/examples/ts/examples/langgraph-agent.ts) for a full working implementation including: * Stateful agent with memory * Tool integration with conditional Nordlys model * Multi-agent workflows * Streaming responses * Human-in-the-loop patterns * Error handling ## Next Steps * Explore [LangGraph prebuilt agents](https://langchain-ai.github.io/langgraphjs/how-tos/create-react-agent/) with Nordlys * Build [multi-agent systems](https://langchain-ai.github.io/langgraphjs/concepts/multi_agent/) with Nordlys model * Implement [persistence](https://langchain-ai.github.io/langgraphjs/how-tos/persistence/) for long-running agents * Add [human-in-the-loop](https://langchain-ai.github.io/langgraphjs/how-tos/human-in-the-loop/) approval workflows * Try [RAG agents](https://langchain-ai.github.io/langgraphjs/tutorials/rag/langgraph_self_rag/) with cost optimization # LlamaIndex Source: https://docs.nordlyslabs.com/integrations/llamaindex Use Nordlys with LlamaIndex for Mixture of Models in RAG applications and AI agents ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Quick Setup ### Installation ```bash pip theme={null} pip install llama-index-llms-openai llama-index-embeddings-openai ``` ```bash uv theme={null} uv add llama-index-llms-openai llama-index-embeddings-openai ``` ```bash poetry theme={null} poetry add llama-index-llms-openai llama-index-embeddings-openai ``` ```bash npm theme={null} npm install llamaindex @llamaindex/openai ``` ```bash yarn theme={null} yarn add llamaindex @llamaindex/openai ``` ```bash pnpm theme={null} pnpm add llamaindex @llamaindex/openai ``` ```bash bun theme={null} bun add llamaindex @llamaindex/openai ``` ### Basic Integration ```python theme={null} import os from llama_index.llms.openai import OpenAI from llama_index.core import Settings # Set your Nordlys API key os.environ["OPENAI_API_KEY"] = os.environ["NORDLYS_API_KEY"] # Initialize OpenAI client with Nordlys endpoint llm = OpenAI( model="nordlys/hypernova", api_base="https://api.nordlyslabs.com/v1", api_key=os.environ["NORDLYS_API_KEY"], ) # Set as global model Settings.llm = llm # Use with simple queries response = llm.complete("What is retrieval-augmented generation?") print(response) ``` ## RAG Example ```python theme={null} from llama_index.core import VectorStoreIndex, SimpleDirectoryReader # Load documents documents = SimpleDirectoryReader("data").load_data() # Create index index = VectorStoreIndex.from_documents(documents) # Query with Mixture of Models query_engine = index.as_query_engine() response = query_engine.query("What are the benefits of RAG?") print(response) ``` ## Key Benefits * **Mixture of Models** - Mixture of Models activation for queries and agents * **RAG-optimized** - Nordlys activates specialists per prompt * **Cost optimization** - 30-70% cost reduction across RAG pipelines * **Agent support** - Mixture of Models activation for function-calling agents ## Next Steps See complete working examples with LlamaIndex Explore all available options and parameters # OpenAI SDK Source: https://docs.nordlyslabs.com/integrations/openai-sdk Drop-in replacement for OpenAI with Nordlys model ## Quick Setup 1. [Sign up for an Nordlys API key](https://nordlyslabs.com/api-platform/orgs) 2. **Install the OpenAI SDK** (if you haven't already): ```bash npm theme={null} npm install openai ``` ```bash yarn theme={null} yarn add openai ``` ```bash pnpm theme={null} pnpm add openai ``` 2. **Change two lines** in your existing code: ```javascript JavaScript/Node.js theme={null} import OpenAI from 'openai'; const openai = new OpenAI({ apiKey: 'your-nordlys-api-key', // ← Your Nordlys API key baseURL: 'https://api.nordlyslabs.com/v1' // ← Only change needed }); // Everything else works exactly the same const completion = await openai.chat.completions.create({ model: 'nordlys/hypernova', messages: [{ role: 'user', content: 'Hello!' }] }); ``` ```python Python theme={null} from openai import OpenAI client = OpenAI( api_key="your-nordlys-api-key", # ← Your Nordlys API key base_url="https://api.nordlyslabs.com/v1" # ← Only change needed ) # Everything else works exactly the same completion = client.chat.completions.create( model="", messages=[{"role": "user", "content": "Hello!"}] ) ``` That's it! Your existing OpenAI code now uses Nordlys model. ## Key Features All OpenAI methods, parameters, and responses work identically Set `model` to `nordlys/hypernova` for the Nordlys model Streaming responses work exactly like OpenAI Function calling and tools work without changes ## Streaming Example ```javascript JavaScript theme={null} const stream = await openai.chat.completions.create({ model: 'nordlys/hypernova', messages: [{ role: 'user', content: 'Tell me a story' }], stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content || ''); } ``` ```python Python theme={null} stream = client.chat.completions.create( model="", messages=[{"role": "user", "content": "Tell me a story"}], stream=True ) for chunk in stream: if chunk.choices[0].delta.content is not None: print(chunk.choices[0].delta.content, end="") ``` ## Response Format Nordlys returns standard OpenAI responses: ```json theme={null} { "id": "chatcmpl-123", "choices": [{ "message": {"content": "Hello! How can I help you?"} }], "usage": {"total_tokens": 21} } ``` ## Error Handling Handle common errors gracefully: ```javascript theme={null} try { const completion = await openai.chat.completions.create({ model: 'nordlys/hypernova', messages: [{ role: 'user', content: 'Hello!' }] }); console.log(completion.choices[0].message.content); } catch (error) { if (error.status === 401) { console.error('Invalid API key'); } else if (error.status === 429) { console.error('Rate limit exceeded - try again later'); } else { console.error('API error:', error.message); } } ``` **Common Issues:** * **401**: Check your Nordlys API key * **429**: Rate limit exceeded - implement retry logic * **400**: Invalid request parameters ## Need More Control? See all available parameters and options Working code examples and use cases # Vercel AI SDK Integration Source: https://docs.nordlyslabs.com/integrations/vercel-ai-sdk Use Nordlys with the Vercel AI SDK for streamlined AI applications ## Get Your Nordlys API Key [Sign up here](https://nordlyslabs.com/api-platform/orgs) to create an account and generate your API key. ## Overview The Vercel AI SDK works seamlessly with Nordlys through two methods: * **Nordlys SDK (Recommended):** Use the native `@nordlys-llm/nordlys-ai-provider` package. * **OpenAI-Compatible Client:** Use Nordlys via `@ai-sdk/openai` with a custom base URL. *** ## Method 1: Nordlys SDK ### Installation ```bash npm theme={null} npm install ai @nordlys-llm/nordlys-ai-provider ``` ```bash yarn theme={null} yarn add ai @nordlys-llm/nordlys-ai-provider ``` ```bash pnpm theme={null} pnpm add ai @nordlys-llm/nordlys-ai-provider ``` ```bash bun theme={null} bun add ai @nordlys-llm/nordlys-ai-provider ``` ### Basic Setup ```javascript Basic Configuration theme={null} import { nordlys } from "@nordlys-llm/nordlys-ai-provider"; // Use default configuration const model = nordlys(); ``` ```javascript Custom Configuration theme={null} import { createNordlys } from "@nordlys-llm/nordlys-ai-provider"; const customNordlys = createNordlys({ baseURL: "https://api.nordlyslabs.com/v1", apiKey: process.env.NORDLYS_API_KEY, headers: { "User-Agent": "MyApp/1.0", }, }); ``` *** ## Method 2: OpenAI-Compatible Client ### Installation ```bash npm theme={null} npm install ai @ai-sdk/openai ``` ```bash yarn theme={null} yarn add ai @ai-sdk/openai ``` ```bash pnpm theme={null} pnpm add ai @ai-sdk/openai ``` ```bash bun theme={null} bun add ai @ai-sdk/openai ``` ### Configuration ```javascript JavaScript/Node.js theme={null} import { openai } from '@ai-sdk/openai'; import { generateText } from 'ai'; const nordlysOpenAI = openai({ apiKey: process.env.NORDLYS_API_KEY, baseURL: 'https://api.nordlyslabs.com/v1', }); const { text } = await generateText({ model: nordlysOpenAI('nordlys/hypernova'), prompt: 'Explain quantum computing simply', }); ``` ```typescript TypeScript theme={null} import { openai } from '@ai-sdk/openai'; import { generateText } from 'ai'; const nordlysOpenAI = openai({ apiKey: process.env.NORDLYS_API_KEY!, baseURL: 'https://api.nordlyslabs.com/v1', }); const { text } = await generateText({ model: nordlysOpenAI('nordlys/hypernova'), prompt: 'Explain quantum computing simply', }); console.log(text); ``` *** ## Text Generation ```javascript Nordlys Provider theme={null} import { generateText } from 'ai'; import { nordlys } from '@nordlys-llm/nordlys-ai-provider'; const { text } = await generateText({ model: nordlys(), prompt: 'Write a vegetarian lasagna recipe for 4 people.', }); ``` ```javascript OpenAI Provider theme={null} import { generateText } from 'ai'; const { text } = await generateText({ model: nordlysOpenAI('nordlys/hypernova'), prompt: 'Write a vegetarian lasagna recipe for 4 people.', }); ``` *** ## Streaming ```javascript Nordlys Provider theme={null} import { streamText } from 'ai'; import { nordlys } from '@nordlys-llm/nordlys-ai-provider'; const { textStream } = await streamText({ model: nordlys(), prompt: 'Explain machine learning step by step', }); for await (const delta of textStream) { process.stdout.write(delta); } ``` ```javascript OpenAI Provider theme={null} import { streamText } from 'ai'; const { textStream } = await streamText({ model: nordlysOpenAI('nordlys/hypernova'), prompt: 'Explain machine learning step by step', }); for await (const delta of textStream) { process.stdout.write(delta); } ``` *** ## React Chat Component ```javascript useChat Hook theme={null} import { useChat } from 'ai/react'; export default function Chat() { const { messages, input, handleInputChange, handleSubmit } = useChat({ api: '/api/chat', // Your API route using Nordlys }); return (
{messages.map(m => (
{m.role}: {m.content}
))}
); } ``` ```javascript API Route - Nordlys Provider theme={null} // pages/api/chat.js or app/api/chat/route.js import { nordlys } from '@nordlys-llm/nordlys-ai-provider'; import { streamText } from 'ai'; export async function POST(req) { const { messages } = await req.json(); const result = await streamText({ model: nordlys(), messages, }); return result.toDataStreamResponse(); } ``` ```javascript API Route - OpenAI Provider theme={null} // pages/api/chat.js or app/api/chat/route.js import { openai } from '@ai-sdk/openai'; import { streamText } from 'ai'; const nordlysOpenAI = openai({ apiKey: process.env.NORDLYS_API_KEY, baseURL: 'https://api.nordlyslabs.com/v1', }); export async function POST(req) { const { messages } = await req.json(); const result = await streamText({ model: nordlysOpenAI('nordlys/hypernova'), messages, }); return result.toDataStreamResponse(); } ```
*** ## Configuration Nordlys keeps advanced tuning internal. Use a Nordlys model ID and focus on your product logic. *** ## Tool/Function Calling ```javascript Nordlys Provider theme={null} import { generateText, tool } from 'ai'; import { z } from 'zod'; import { nordlys } from '@nordlys-llm/nordlys-ai-provider'; const { text } = await generateText({ model: nordlys(), prompt: "What's the weather in New York?", tools: { getWeather: tool({ description: 'Get weather for a location', parameters: z.object({ location: z.string(), }), execute: async ({ location }) => { return `Weather in ${location} is sunny and 72°F`; }, }), }, }); ``` ```javascript OpenAI Provider theme={null} import { generateText, tool } from 'ai'; import { z } from 'zod'; const { text } = await generateText({ model: nordlysOpenAI('nordlys/hypernova'), prompt: "What's the weather in New York?", tools: { getWeather: tool({ description: 'Get weather for a location', parameters: z.object({ location: z.string(), }), execute: async ({ location }) => { return `Weather in ${location} is sunny and 72°F`; }, }), }, }); ``` *** ## Environment Variables ```bash Environment Setup theme={null} # .env.local NORDLYS_API_KEY=your-nordlys-api-key ``` *** ## Error Handling Nordlys retries transient errors automatically. For comprehensive error handling patterns, see the [Error Handling Guide](/guides/error-handling). ```typescript theme={null} import { useChat } from 'ai/react'; export default function Chat() { const { messages, input, handleInputChange, handleSubmit, error, reload } = useChat({ api: '/api/chat', onError: (error) => { console.error('Nordlys chat error:', error); }, }); return (
{/* Your chat UI */} {error && (
{error.message}
)}
); } ``` *** ## What You Get The right specialists activate per prompt Real-time response streaming with React components Significant cost savings through lab‑tuned models Inspect latency and quality signals per request ## Next Steps See complete working examples Explore all available options and parameters # Model Reference Source: https://docs.nordlyslabs.com/model-reference Available Nordlys models with pricing and specifications ## Available Models | Model | Model ID | Context Window | | --------- | ------------------- | -------------- | | Hypernova | `nordlys/hypernova` | 200K tokens | Hypernova is a Mixture of Models system that activates the right models per prompt. ## Pricing | Token Type | Price (per 1M tokens) | | ------------ | --------------------- | | Input | \$4.00 | | Cached Input | \$0.40 | | Output | \$12.00 | ## Supported Endpoints | Endpoint | Format | | ---------------------------------------- | ---------------- | | `/v1/chat/completions` | OpenAI | | `/v1/messages` | Anthropic | | `/v1/responses` | OpenAI Responses | | `/v1beta/models/{model}:generateContent` | Gemini | ## Quick Example ```bash theme={null} curl https://api.nordlyslabs.com/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "nordlys/hypernova", "messages": [{"role": "user", "content": "Hello!"}]}' ``` # Privacy Policy Source: https://docs.nordlyslabs.com/privacy-policy Privacy Policy for Nordlys AI model infrastructure platform # Privacy Policy **Last updated:** December 2024 ## 1. Introduction Nordlys ("we," "our," or "us") is committed to protecting your privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our AI model infrastructure platform ("Service"). Please read this privacy policy carefully. **Key Point:** Our platform may use third-party model partners to generate responses. Your data may be processed by these partners according to their own privacy policies. ## 2. Information We Collect ### 2.1 Information You Provide * **Account Information:** Name, email address, organization details * **Authentication Data:** Login credentials, API keys for Nordlys * **Chat Content:** Your prompts, messages, conversations, and AI responses * **Payment Information:** Billing details processed securely through Stripe * **Support Communications:** Messages sent through our support channels ### 2.2 Automatically Collected Information * **Usage Analytics:** API request counts, token usage, response times, error rates * **Technical Data:** IP addresses, browser information, device identifiers * **Performance Metrics:** System performance, latency measurements, model statistics * **Log Data:** Server logs, error reports, security events * **Cookies:** Authentication tokens, preferences, session data ### 2.3 Third-Party Model Partner Data * **Partner Responses:** AI-generated content from external model partners * **Partner Metadata:** Model information, usage statistics, cost calculations * **Partner Configurations:** Your custom configuration settings (when applicable) ## 3. How We Use Your Information We use your information to: * **Provide the Service:** Process requests, manage conversations, generate responses * **Account Management:** Create accounts, authenticate users, manage subscriptions * **Analytics:** Generate usage reports, cost analysis, performance metrics * **Optimization:** Improve service performance, Nordlys model, Nordlys model efficiency * **Support:** Respond to inquiries, troubleshoot issues, provide assistance * **Security:** Monitor for abuse, prevent fraud, maintain system security * **Compliance:** Meet legal obligations and industry standards * **Communications:** Send service notifications, updates, billing information ## 4. Third-Party Partner Data Sharing **Important:** When you use our service, your prompts and data are sent to third-party model partners to generate responses. Each partner may have different data handling practices. ### 4.1 Partners We Work With Nordlys works with a set of external model partners. Contact support for the current list. ### 4.2 Data Shared with Partners * Your prompts and conversation messages * Model configuration parameters * Request metadata (timestamp, Nordlys model) ### 4.3 Partner Data Policies Each partner has their own data handling practices. We recommend reviewing their privacy policies: * Some partners may use your data to improve their models unless you opt out * Data retention periods vary by partner * Some partners offer enterprise agreements with enhanced privacy protections * Geographic data processing locations may differ ## 5. Data Storage and Security ### 5.1 Data Storage PostgreSQL with encrypted sensitive fields Regular encrypted backups with retention policies Data stored in secure cloud infrastructure ### 5.2 Security Measures TLS for data in transit, encryption at rest for sensitive data Role-based access with principle of least privilege Secure authentication via Clerk, API key management Real-time security monitoring and alerting Comprehensive logging of system access and changes Security patches and vulnerability management ### 5.3 Data Retention * **Chat History:** Stored until you delete or account termination * **Usage Analytics:** Retained for 2 years for billing and compliance * **Account Data:** Retained while account is active * **Support Data:** Retained for 3 years after resolution * **Log Data:** Automatically deleted after 90 days ## 6. Data Subject Rights You have the following rights regarding your personal data: Request information about data we process Correct inaccurate personal data Request deletion of your personal data Receive your data in a structured format Limit how we process your data Object to processing for legitimate interests Withdraw consent where applicable To exercise these rights, contact us through our support channels. We will respond within 30 days. ## 7. Cookies and Tracking We use cookies and similar technologies for: * **Essential Cookies:** Authentication, security, basic functionality * **Analytics Cookies:** Usage statistics and performance monitoring * **Preference Cookies:** User settings and interface preferences You can control cookies through your browser settings, but this may affect service functionality. ## 8. International Data Transfers Your data may be transferred to and processed in countries other than your country of residence. When we transfer data internationally, we use appropriate safeguards such as: * Standard contractual clauses * Adequacy decisions by relevant authorities * Certification schemes * Provider-specific privacy frameworks ## 9. Children's Privacy Our service is not intended for children under 13 (or the applicable age of digital consent in your jurisdiction). We do not knowingly collect personal information from children. If we become aware that we have collected data from a child, we will take steps to delete it promptly. ## 10. Business Transfers In the event of a merger, acquisition, or sale of assets, your information may be transferred to the new entity. We will provide notice before your data is transferred and becomes subject to different privacy practices. ## 11. Legal Disclosure We may disclose your information when required by law or to: * Comply with legal process or government requests * Protect our rights, property, or safety * Protect users or the public from harm * Investigate fraud or security issues * Enforce our terms of service ## 12. Privacy Policy Updates We may update this Privacy Policy periodically. Material changes will be communicated via: * Email notification to registered users * Platform notifications * Updated "Last modified" date on this page Continued use of the service after changes constitutes acceptance of the updated policy. ## 13. Third-Party Links Our service may contain links to third-party websites or services. We are not responsible for the privacy practices of these external sites. We encourage you to review their privacy policies before providing any personal information. ## 14. Contact Information For privacy-related questions, concerns, or requests, please contact us through: * Our support channels available on the platform * The contact information provided in your account dashboard * Email support with "Privacy" in the subject line We are committed to addressing your privacy concerns promptly and transparently. # Quickstart Source: https://docs.nordlyslabs.com/quickstart Get started with Nordlys in under 5 minutes Get started with Nordlys by changing one line of code. No complex setup required. Nordlys is a Mixture of Models model: each prompt activates the right models under the hood. ## Step 1: Get Your API Key [Create a free account](https://www.nordlyslabs.com/api-platform/orgs) to get started Generate your API key from the dashboard ## Step 2: Install SDK (Optional) ```bash pip theme={null} pip install nordlys-py ``` ```bash uv theme={null} uv add nordlys-py ``` ```bash poetry theme={null} poetry add nordlys-py ``` Python only - native Nordlys SDK with Registry and Router APIs ```bash pip theme={null} pip install openai ``` ```bash uv theme={null} uv add openai ``` ```bash poetry theme={null} poetry add openai ``` ```bash npm theme={null} npm install openai ``` ```bash pnpm theme={null} pnpm add openai ``` ```bash yarn theme={null} yarn add openai ``` ```bash bun theme={null} bun add openai ``` ```bash pip theme={null} pip install anthropic ``` ```bash uv theme={null} uv add anthropic ``` ```bash poetry theme={null} poetry add anthropic ``` ```bash npm theme={null} npm install @anthropic-ai/sdk ``` ```bash pnpm theme={null} pnpm add @anthropic-ai/sdk ``` ```bash yarn theme={null} yarn add @anthropic-ai/sdk ``` ```bash bun theme={null} bun add @anthropic-ai/sdk ``` ```bash pip theme={null} pip install google-generativeai ``` ```bash uv theme={null} uv add google-generativeai ``` ```bash poetry theme={null} poetry add google-generativeai ``` ```bash npm theme={null} npm install @google/genai ``` ```bash pnpm theme={null} pnpm add @google/genai ``` ```bash yarn theme={null} yarn add @google/genai ``` ```bash bun theme={null} bun add @google/genai ``` ```bash npm theme={null} npm install ai @ai-sdk/openai ``` ```bash pnpm theme={null} pnpm add ai @ai-sdk/openai ``` ```bash yarn theme={null} yarn add ai @ai-sdk/openai ``` ```bash bun theme={null} bun add ai @ai-sdk/openai ``` Node.js only ```bash pip theme={null} pip install langchain-openai ``` ```bash uv theme={null} uv add langchain-openai ``` ```bash poetry theme={null} poetry add langchain-openai ``` ```bash npm theme={null} npm install @langchain/openai ``` ```bash pnpm theme={null} pnpm add @langchain/openai ``` ```bash yarn theme={null} yarn add @langchain/openai ``` ```bash bun theme={null} bun add @langchain/openai ``` No installation required - cURL is available on most systems. ## Authentication Nordlys uses API keys for authentication. Include your API key in requests: * Header: `Authorization: Bearer YOUR_API_KEY` * Store keys in environment variables (`NORDLYS_API_KEY`) ## Step 3: Make Your First Request Choose your preferred language and framework: ```python Synchronous theme={null} from nordlys_py import Nordlys nordlys = Nordlys(api_key="your-nordlys-api-key") response = nordlys.chat.completions.create( model="nordlys/hypernova", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content) ``` ```python Asynchronous theme={null} import asyncio from nordlys_py import AsyncNordlys async def main(): async with AsyncNordlys(api_key="your-nordlys-api-key") as nordlys: response = await nordlys.chat.completions.create( model="nordlys/hypernova", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content) asyncio.run(main()) ``` ```javascript JavaScript/Node.js theme={null} import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'your-nordlys-api-key', baseURL: 'https://api.nordlyslabs.com/v1' }); const response = await client.chat.completions.create({ model: 'nordlys/hypernova', messages: [{ role: 'user', content: 'Hello!' }] }); console.log(response.choices[0].message.content); ``` ```python Python theme={null} from openai import OpenAI client = OpenAI( api_key="your-nordlys-api-key", base_url="https://api.nordlyslabs.com/v1" ) response = client.chat.completions.create( model="nordlys/hypernova", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content) ``` ```bash cURL theme={null} curl https://api.nordlyslabs.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer apk_123456" \ -d '{ "model": "nordlys/hypernova", "messages": [{"role": "user", "content": "Hello!"}] }' ``` ```javascript JavaScript/Node.js theme={null} import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: 'your-nordlys-api-key', baseURL: 'https://api.nordlyslabs.com/v1' }); const response = await client.messages.create({ model: 'nordlys/hypernova', max_tokens: 1000, messages: [{ role: 'user', content: 'Hello!' }] }); console.log(response.content[0].text); ``` ```python Python theme={null} import anthropic client = anthropic.Anthropic( api_key="your-nordlys-api-key", base_url="https://api.nordlyslabs.com/v1" ) response = client.messages.create( model="nordlys/hypernova", max_tokens=1000, messages=[{"role": "user", "content": "Hello!"}] ) print(response.content[0].text) ``` ```bash cURL theme={null} curl https://api.nordlyslabs.com/v1/messages \ -H "Content-Type: application/json" \ -H "Authorization: Bearer apk_123456" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "nordlys/hypernova", "max_tokens": 1000, "messages": [{"role": "user", "content": "Hello!"}] }' ``` ```javascript JavaScript/Node.js theme={null} import { GoogleGenerativeAI } from '@google/genai'; const genAI = new GoogleGenerativeAI({ apiKey: process.env.NORDLYS_API_KEY || 'your-nordlys-api-key', httpOptions: { baseUrl: 'https://api.nordlyslabs.com/v1beta' } }); const model = genAI.getGenerativeModel({ model: 'nordlys/hypernova' }); const result = await model.generateContent({ contents: [ { role: 'user', parts: [{ text: 'Hello!' }] } ], generationConfig: { maxOutputTokens: 512 } }); console.log(result.response.text()); ``` ```python Python theme={null} import os import google.generativeai as genai genai.configure( api_key=os.getenv("NORDLYS_API_KEY", "your-nordlys-api-key"), transport="rest", client_options={"api_endpoint": "https://api.nordlyslabs.com/v1beta"} ) model = genai.GenerativeModel("nordlys/hypernova") response = model.generate_content( "Hello!", generation_config={"max_output_tokens": 512} ) print(response.text) ``` ```bash cURL theme={null} curl https://api.nordlyslabs.com/v1beta/models/nordlys/hypernova:generateContent \ -H "Content-Type: application/json" \ -H "Authorization: Bearer apk_123456" \ -d '{ "contents": [ { "role": "user", "parts": [{"text": "Hello!"}] } ], "generationConfig": { "maxOutputTokens": 512 } }' ``` ```javascript Basic Text Generation theme={null} import { openai } from '@ai-sdk/openai'; import { generateText } from 'ai'; const { text } = await generateText({ model: openai('nordlys/hypernova', { baseURL: 'https://api.nordlyslabs.com/v1', apiKey: 'your-nordlys-api-key' }), prompt: 'Hello!' }); console.log(text); ``` ```javascript Streaming theme={null} import { openai } from '@ai-sdk/openai'; import { streamText } from 'ai'; const { textStream } = await streamText({ model: openai('nordlys/hypernova', { baseURL: 'https://api.nordlyslabs.com/v1', apiKey: 'your-nordlys-api-key' }), prompt: 'Write a story about AI' }); for await (const delta of textStream) { process.stdout.write(delta); } ``` ```javascript React Components theme={null} import { useChat } from 'ai/react'; export default function Chat() { const { messages, input, handleInputChange, handleSubmit } = useChat({ api: '/api/chat', // Your API route initialMessages: [{ role: 'system', content: 'Hello!' }] }); return (
{messages.map(m => (
{m.role}: {m.content}
))}
); } ```
```javascript JavaScript/Node.js theme={null} import { ChatOpenAI } from '@langchain/openai'; const model = new ChatOpenAI({ openAIApiKey: 'your-nordlys-api-key', configuration: { baseURL: 'https://api.nordlyslabs.com/v1' }, modelName: 'nordlys/hypernova' }); const response = await model.invoke('Hello!'); console.log(response.content); ``` ```python Python theme={null} from langchain_openai import ChatOpenAI model = ChatOpenAI( openai_api_key="your-nordlys-api-key", openai_api_base="https://api.nordlyslabs.com/v1", model_name="nordlys/hypernova" ) response = model.invoke("Hello!") print(response.content) ``` ```python Chains theme={null} from langchain_openai import ChatOpenAI from langchain.chains import AI modelChain from langchain.prompts import PromptTemplate model = ChatOpenAI( openai_api_key="your-nordlys-api-key", openai_api_base="https://api.nordlyslabs.com/v1", model_name="nordlys/hypernova" ) prompt = PromptTemplate( input_variables=["topic"], template="Write a brief summary about {topic}" ) chain = AI modelChain(llm=model, prompt=prompt) result = chain.run(topic="artificial intelligence") print(result) ```
## Error Handling Always implement proper error handling in production. Nordlys provides detailed error information to help you build resilient applications. ```typescript TypeScript theme={null} import OpenAI from 'openai'; const client = new OpenAI({ apiKey: process.env.NORDLYS_API_KEY, baseURL: 'https://api.nordlyslabs.com/v1' }); async function chatWithRetry(message: string, maxRetries = 3) { for (let attempt = 1; attempt <= maxRetries; attempt++) { try { const response = await client.chat.completions.create({ model: 'nordlys/hypernova', messages: [{ role: 'user', content: message }] }); return response.choices[0].message.content; } catch (error: any) { console.error(`Attempt ${attempt} failed:`, error.message); if (attempt === maxRetries) throw error; // Exponential backoff await new Promise(resolve => setTimeout(resolve, Math.pow(2, attempt) * 1000) ); } } } // Usage try { const result = await chatWithRetry('Explain quantum computing'); console.log(result); } catch (error) { console.error('All retries failed:', error); // Implement your preferred recovery behavior (message, etc.) } ``` ```python Python theme={null} import os import time from openai import OpenAI client = OpenAI( api_key=os.environ['NORDLYS_API_KEY'], base_url='https://api.nordlyslabs.com/v1' ) def chat_with_retry(message: str, max_retries: int = 3): for attempt in range(1, max_retries + 1): try: response = client.chat.completions.create( model='nordlys/hypernova', messages=[{'role': 'user', 'content': message}] ) return response.choices[0].message.content except Exception as error: print(f"Attempt {attempt} failed: {error}") if attempt == max_retries: raise # Exponential backoff time.sleep(2 ** attempt) # Usage try: result = chat_with_retry('Explain quantum computing') print(result) except Exception as error: print(f"All retries failed: {error}") # Implement recovery behavior ``` ```javascript JavaScript (Browser) theme={null} async function nordlysChat(messages, options = {}) { const { maxRetries = 3, recoveryMessage = 'Service temporarily unavailable' } = options; for (let attempt = 1; attempt <= maxRetries; attempt++) { try { const response = await fetch('https://api.nordlyslabs.com/v1/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer apk_123456' }, body: JSON.stringify({ model: 'nordlys/hypernova', messages, temperature: 0.7 }) }); if (!response.ok) { const errorData = await response.json(); throw new Error(`API Error: ${errorData.error?.message || response.statusText}`); } const data = await response.json(); return data.choices[0].message.content; } catch (error) { console.error(`Attempt ${attempt} failed:`, error.message); if (attempt === maxRetries) { return recoveryMessage; } // Exponential backoff await new Promise(resolve => setTimeout(resolve, Math.pow(2, attempt) * 1000) ); } } } // Usage const messages = [{ role: 'user', content: 'Hello!' }]; const response = await nordlysChat(messages); console.log(response); ``` **Production Tip**: Always log the `request_id` from error responses for debugging. For comprehensive error handling patterns, see the [Error Handling Best Practices](/guides/error-handling) guide. ## Example Response ```json OpenAI Format theme={null} { "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1677652288, "model": "gpt-5-nano", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello! I'm ready to help you." }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 5, "completion_tokens": 10, "total_tokens": 15 } } ``` ```json Anthropic Format theme={null} { "id": "msg_abc123", "type": "message", "role": "assistant", "content": [{ "type": "text", "text": "Hello! I'm ready to help you." }], "model": "claude-3-5-haiku", "stop_reason": "end_turn", "usage": { "input_tokens": 5, "output_tokens": 10 } } ``` Nordlys returns standard OpenAI or Anthropic-compatible responses. ## Testing Your Integration Run your code with a simple message like "Hello!" to verify the connection Confirm you receive a response and check the `model` field in the response View request logs and analytics in your [Nordlys dashboard](https://www.nordlyslabs.com/api-platform/orgs) ## Next Steps Learn about Nordlys model specifications and pricing Detailed guides for each SDK and framework Complete API documentation with all parameters Working examples for common use cases ## Need Help? Common issues and their solutions Get help from our team # Terms of Service Source: https://docs.nordlyslabs.com/terms-of-service Terms of Service for Nordlys AI model infrastructure platform # Terms of Service **Last updated:** December 2024 ## 1. Acceptance of Terms By accessing or using Nordlys's services ("Platform"), you agree to be bound by these Terms of Service ("Terms"). If you disagree with any part of these terms, you may not access the service. ## 2. Description of Service Nordlys provides an advanced AI model infrastructure platform and Mixture of Models model. We may rely on third-party model partners to fulfill requests ("Third-Party Partners"). Mixture of Models access and lab-grade tuning Chat interface and conversation management API key management and authentication Usage analytics and cost optimization Credit management and billing ## 3. Third-Party Partner Terms **Important Notice:** When you use our service, your data and requests may be processed by third-party model partners. Each partner has their own terms of service and data handling practices. By using Nordlys, you acknowledge and agree that: * Your prompts, messages, and generated responses may be processed and temporarily stored by Third-Party Partners * Each Third-Party Partner may have different data retention and privacy policies * You are responsible for reviewing and complying with each partner's terms of service * Nordlys acts as an intermediary and is not responsible for Third-Party Partner policies or actions * Some partners may use your data to improve their models unless you opt out through their respective platforms ## 4. User Responsibilities Ensure all account and usage information is accurate and complete Keep your API keys and login credentials secure and confidential Do not share your account with unauthorized parties Use the service in compliance with all applicable laws and regulations Do not attempt to circumvent usage limits or security measures Use the service only for legal, appropriate, and permitted purposes Respect Third-Party Partner usage policies and rate limits ## 5. Prohibited Uses **Prohibited Activities**: The following uses are strictly forbidden: Generate illegal, harmful, or abusive content Violate Nordlys acceptable use policies Infringe on intellectual property rights Distribute malware or engage in malicious activities Impersonate others or provide false information Attempt to reverse engineer or manipulate our systems Exceed rate limits or abuse the service ## 6. Data Processing and Storage We process and store the following types of data: * **Chat Data:** Your conversations, prompts, and AI responses are stored to provide the service * **Usage Analytics:** Request counts, token usage, costs, and performance metrics * **Account Information:** Profile data, organization details, and billing information * **API Keys:** Your Nordlys API keys are encrypted and stored securely * **Technical Data:** Logs, error reports, and system performance data This data may be shared with Third-Party Partners as necessary to fulfill your requests. See our Privacy Policy for detailed information about data handling. ## 7. Billing and Credits **Credit-Based System**: Our service operates on a pay-as-you-go credit model Credits consumed based on token usage and underlying costs Billing processed through Stripe with standard payment terms Credits are non-refundable once consumed Unused credits may expire according to your plan terms Monitor your credit balance to avoid service interruption Service may be suspended if credits are insufficient ## 8. Service Availability We strive to maintain high availability but cannot guarantee uninterrupted service. Service availability depends on: * Third-Party Provider uptime and performance * Network connectivity and infrastructure * Scheduled maintenance and updates * Force majeure events beyond our control ## 9. Intellectual Property The Nordlys platform, including its code, design, and documentation, is protected by intellectual property laws. You retain ownership of your input data and generated content, subject to Third-Party Provider terms. ## 10. Limitation of Liability TO THE MAXIMUM EXTENT PERMITTED BY LAW, NORDLYS SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING WITHOUT LIMITATION, LOSS OF PROFITS, DATA, USE, OR OTHER INTANGIBLE LOSSES. ## 11. Indemnification You agree to indemnify and hold harmless Nordlys from any claims, damages, or expenses arising from: * Your use of the service * Your violation of these terms * Your violation of Third-Party Provider terms * Content you submit or generate ## 12. Termination We may terminate or suspend your account immediately, without prior notice, if you breach these terms. You may terminate your account at any time by contacting us. Upon termination: * Your access to the service will cease * Data may be deleted according to our retention policy * Unused credits may be forfeited * Outstanding charges remain due ## 13. Changes to Terms We reserve the right to modify these terms at any time. We will notify users of material changes via email or platform notifications. Continued use constitutes acceptance of updated terms. ## 14. Governing Law These terms are governed by and construed in accordance with the laws of the jurisdiction where Nordlys is incorporated, without regard to conflict of law principles. ## 15. Contact Information For questions about these Terms of Service, please contact us through our support channels or at the contact information provided on our platform. # Troubleshooting Source: https://docs.nordlyslabs.com/troubleshooting Common issues and solutions when using Nordlys API ## Common Issues ### Authentication Problems **Problem:** Getting authentication errors when making API calls. **Solutions:** 1. **Check your API key:** ```bash theme={null} # Verify your API key is set correctly echo $NORDLYS_API_KEY ``` 2. **Ensure correct format:** ```javascript theme={null} // Correct - no 'Bearer' prefix needed const openai = new OpenAI({ apiKey: 'your-nordlys-api-key', baseURL: 'https://api.nordlyslabs.com/v1' }); ``` 3. **Verify API key validity:** * Check if your API key has expired * Ensure you're using the correct key for your environment * Try regenerating your API key in the dashboard 4. **Test with curl:** ```bash theme={null} curl -H "Authorization: Bearer apk_123456" \ -H "Content-Type: application/json" \ https://api.nordlyslabs.com/v1/chat/completions \ -d '{"model":"nordlys/hypernova","messages":[{"role":"user","content":"test"}]}' ``` **Problem:** Environment variable not being loaded. **Solutions:** 1. **Check environment variable:** ```bash theme={null} # In terminal export NORDLYS_API_KEY=your-key-here # Or in .env file echo "NORDLYS_API_KEY=your-key-here" >> .env ``` 2. **Load environment variables:** ```javascript theme={null} // Node.js require('dotenv').config(); // Or using ES modules import 'dotenv/config'; ``` 3. **Python environment:** ```python theme={null} import os from dotenv import load_dotenv load_dotenv() api_key = os.getenv("NORDLYS_API_KEY") ``` ### Configuration Issues **Problem:** Using incorrect base URL causing connection failures. **Correct base URL:** ``` https://api.nordlyslabs.com/v1 ``` **Common mistakes:** ```javascript theme={null} // ❌ Wrong baseURL: 'https://api.openai.com/v1' baseURL: 'https://nordlys.ai/api/v1' baseURL: 'https://www.nordlyslabs.com/v1' // ✅ Correct baseURL: 'https://api.nordlyslabs.com/v1' ``` **Problem:** Nordlys model not working or model errors. **Solutions:** 1. **Use default model ID for Nordlys model:** ```javascript theme={null} // ✅ Correct - enables Nordlys model model: "nordlys/hypernova" // ❌ Wrong - tries to use specific model model: "nordlys" model: "nordlys-code" model: "nordlys/nordlys" ``` 2. **TypeScript type issues:** ```typescript theme={null} // Option 1: Type assertion model: "nordlys/hypernova" as any // Option 2: Disable strict checking for this parameter // @ts-ignore model: "nordlys/hypernova" ``` **Problem:** Certificate validation errors in some environments. **Solutions:** 1. **Update certificates:** ```bash theme={null} # Ubuntu/Debian sudo apt-get update && sudo apt-get install ca-certificates # macOS brew install ca-certificates ``` 2. **Node.js certificate issues:** ```javascript theme={null} // Temporary workaround (not recommended for production) process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0; // Better solution: update Node.js or certificates ``` 3. **Python certificate issues:** ```python theme={null} import ssl import certifi # Ensure certificates are up to date ssl.create_default_context(cafile=certifi.where()) ``` ### Request/Response Issues **Problem:** Getting empty responses or no content. **Diagnostic steps:** 1. **Check request format:** ```javascript theme={null} const completion = await openai.chat.completions.create({ model: "nordlys/hypernova", messages: [ { role: "user", content: "Hello" } // Ensure content is not empty ] }); ``` 2. **Verify response handling:** ```javascript theme={null} console.log("Full response:", completion); console.log("Content:", completion.choices[0]?.message?.content); ``` 3. **Check for API errors:** ```javascript theme={null} try { const completion = await openai.chat.completions.create({...}); } catch (error) { console.log("Error details:", error); console.log("Status:", error.status); console.log("Message:", error.message); } ``` **Problem:** Streaming responses not appearing or failing. **Solutions:** 1. **Check streaming syntax:** ```javascript theme={null} // ✅ Correct streaming setup const stream = await openai.chat.completions.create({ model: "nordlys/hypernova", messages: [...], stream: true }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content || ''); } ``` 2. **Browser streaming with fetch:** ```javascript theme={null} const response = await fetch('/api/stream-chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message }) }); const reader = response.body.getReader(); const decoder = new TextDecoder(); while (true) { const { done, value } = await reader.read(); if (done) break; const chunk = decoder.decode(value); // Process chunk... } ``` 3. **Server-sent events setup:** ```javascript theme={null} // Server res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive' }); ``` **Problem:** Getting 429 errors (rate limit exceeded). **Solutions:** 1. **Implement exponential backoff:** ```javascript theme={null} async function retryWithBackoff(fn, maxRetries = 3) { for (let i = 0; i < maxRetries; i++) { try { return await fn(); } catch (error) { if (error.status === 429 && i < maxRetries - 1) { const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s await new Promise(resolve => setTimeout(resolve, delay)); continue; } throw error; } } } ``` 2. **Check your rate limits:** * **Free tier**: 100 requests/minute, 10,000 tokens/minute * **Pro tier**: 1,000 requests/minute, 100,000 tokens/minute * **Enterprise**: Custom limits 3. **Implement request queuing:** ```javascript theme={null} class RequestQueue { constructor(maxPerMinute = 100) { this.queue = []; this.maxPerMinute = maxPerMinute; this.requestTimes = []; } async enqueue(requestFn) { return new Promise((resolve, reject) => { this.queue.push({ requestFn, resolve, reject }); this.processQueue(); }); } async processQueue() { if (this.queue.length === 0) return; const now = Date.now(); this.requestTimes = this.requestTimes.filter(time => now - time < 60000); if (this.requestTimes.length < this.maxPerMinute) { const { requestFn, resolve, reject } = this.queue.shift(); this.requestTimes.push(now); try { const result = await requestFn(); resolve(result); } catch (error) { reject(error); } // Process next request setTimeout(() => this.processQueue(), 100); } else { // Wait and try again setTimeout(() => this.processQueue(), 1000); } } } ``` ### Integration-Specific Issues **Problem:** LangChain not working with Nordlys. **Solutions:** 1. **Correct LangChain setup:** ```python theme={null} # Python from langchain_openai import ChatOpenAI llm = ChatOpenAI( api_key=os.getenv("NORDLYS_API_KEY"), base_url="https://api.nordlyslabs.com/v1", model="nordlys/hypernova" # Important: default model ID ) ``` ```javascript theme={null} // JavaScript import { ChatOpenAI } from "@langchain/openai"; const llm = new ChatOpenAI({ apiKey: process.env.NORDLYS_API_KEY, configuration: { baseURL: "https://api.nordlyslabs.com/v1" }, model: "nordlys/hypernova" }); ``` 2. **Handle LangChain-specific errors:** ```python theme={null} from openai import APIError try: response = llm.invoke("Hello") except APIError as e: print(f"API Error: {e}") except Exception as e: print(f"Other error: {e}") ``` **Problem:** Vercel AI SDK not connecting properly. **Solutions:** 1. **Using the OpenAI-compatible client:** ```javascript theme={null} import { openai } from '@ai-sdk/openai'; const nordlysOpenAI = openai({ apiKey: process.env.NORDLYS_API_KEY, baseURL: 'https://api.nordlyslabs.com/v1', }); const { text } = await generateText({ model: nordlysOpenAI('nordlys/hypernova'), prompt: 'Hello' }); ``` 2. **TypeScript issues:** ```typescript theme={null} // If getting type errors const model = nordlysOpenAI('nordlys/hypernova' as any); ``` 3. **Environment variables in Next.js:** ```javascript theme={null} // next.config.js module.exports = { env: { NORDLYS_API_KEY: process.env.NORDLYS_API_KEY, }, }; ``` ## Nordlys Error Scenarios ### Model Registry Errors (404) **Symptom:** ```json theme={null} { "error": { "type": "model_registry_error", "message": "Model 'invalid-model' not found" } } ``` **Common causes:** * Typo in model name * Model not available in your region * Model temporarily disabled **Solutions:** 1. **Check for typos** in your model ID 2. **Use the default model**: ```javascript theme={null} model: "nordlys/hypernova" // ✅ Recommended default ``` 3. **Contact support** if the model remains unavailable ### Upstream Service Errors **Symptom:** ```json theme={null} { "error": { "type": "upstream_error", "message": "Upstream service error: rate limit exceeded" } } ``` **Solutions:** * Retry with exponential backoff * Check rate limits in your dashboard * Reduce request frequency or batch size ## Error Investigation Checklist When encountering errors: 1. **Capture Context** * [ ] Copy full error response * [ ] Note the request\_id * [ ] Record timestamp * [ ] Save request payload (redacted) 2. **Check Error Details** * [ ] Error type and HTTP code * [ ] Upstream error details (if present) * [ ] Duration metrics * [ ] Any retry-after headers 3. **Verify Configuration** * [ ] API key is valid * [ ] Base URL is correct * [ ] Model identifier is valid * [ ] Request payload structure 4. **Review Documentation** * [ ] [Error Reference](/api-reference/errors) * [ ] [Error Handling Guide](/guides/error-handling) 5. **Contact Support** (if needed) * Include request\_id * Provide error reproduction steps * Share redacted request/response ## Performance Issues **Problem:** Responses taking longer than expected. **Diagnostic steps:** 1. **Reduce prompt size:** Keep prompts concise and trim long chat histories. 2. **Batch smaller requests:** Split large documents into smaller chunks. 3. **Check local network latency:** Test connectivity to `api.nordlyslabs.com`. **Problem:** Network latency issues. **Solutions:** 1. **Check your network:** ```bash theme={null} # Test connectivity ping nordlyslabs.com # Test TLS handshake curl -w "@curl-format.txt" -o /dev/null https://api.nordlyslabs.com/v1/models ``` 2. **Implement timeout handling:** ```javascript theme={null} const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), 30000); // 30s timeout try { const completion = await openai.chat.completions.create({ model: "nordlys/hypernova", messages: [...] }, { signal: controller.signal }); } catch (error) { if (error.name === 'AbortError') { console.log('Request timed out'); } } finally { clearTimeout(timeoutId); } ``` 3. **Use connection pooling:** ```javascript theme={null} import https from 'https'; const agent = new https.Agent({ keepAlive: true, maxSockets: 10 }); const openai = new OpenAI({ apiKey: process.env.NORDLYS_API_KEY, baseURL: 'https://api.nordlyslabs.com/v1', httpAgent: agent }); ``` ## Development Environment Issues **Problem:** Cross-origin resource sharing errors. **Solutions:** 1. **Never call API directly from browser:** ```javascript theme={null} // ❌ Wrong - exposes API key // const completion = await openai.chat.completions.create({...}); // ✅ Correct - use your backend const response = await fetch('/api/chat', { method: 'POST', body: JSON.stringify({ message }) }); ``` 2. **Set up proxy in development:** ```javascript theme={null} // Next.js API route // pages/api/chat.js export default async function handler(req, res) { const completion = await openai.chat.completions.create({ model: "nordlys/hypernova", messages: req.body.messages }); res.json({ response: completion.choices[0].message.content }); } ``` 3. **Configure CORS for your backend:** ```javascript theme={null} // Express.js app.use(cors({ origin: ['http://localhost:3000', 'https://yourdomain.com'], credentials: true })); ``` **Problem:** TypeScript errors with Nordlys integration. **Solutions:** 1. **Install correct types:** ```bash theme={null} npm install --save-dev @types/node npm install openai # Latest version includes types ``` 2. **Type assertion for model parameter:** ```typescript theme={null} const completion = await openai.chat.completions.create({ model: "nordlys/hypernova" as any, // Type assertion messages: [...] }); ``` 3. **Create custom types if needed:** ```typescript theme={null} interface NordlysCompletion extends ChatCompletion { model: string; } ``` **Problem:** ES modules vs CommonJS issues. **Solutions:** 1. **Use correct imports:** ```javascript theme={null} // ES modules import OpenAI from 'openai'; // CommonJS const OpenAI = require('openai'); ``` 2. **Package.json configuration:** ```json theme={null} { "type": "module", "dependencies": { "openai": "^4.0.0" } } ``` 3. **Node.js version compatibility:** ```bash theme={null} # Check Node.js version node --version # Nordlys requires Node.js 18+ # Update if necessary ``` ## Getting Help ### Debug Information to Collect When reporting issues, please include: ```bash theme={null} # System info node --version npm --version # Package versions npm list openai npm list @langchain/openai ``` ```javascript theme={null} // Sanitized request (remove API key) { "model": "nordlys/hypernova", "messages": [...], "temperature": 0.7 } ``` ```javascript theme={null} console.log("Error status:", error.status); console.log("Error message:", error.message); console.log("Error stack:", error.stack); ``` ```bash theme={null} # Test connectivity curl -I https://api.nordlyslabs.com/v1/models # DNS resolution nslookup nordlyslabs.com ``` ### Support Channels Check our comprehensive guides and API reference for solutions Report bugs and request features on our GitHub repository Get help from the community and Nordlys team members Contact [support@nordlys.com](mailto:support@nordlys.com) for priority assistance ### Best Practices for Debugging Test basic functionality first ```javascript theme={null} const simple = await openai.chat.completions.create({ model: "nordlys/hypernova", messages: [{ role: "user", content: "Hello" }] }); ``` Add detailed logging to understand what's happening ```javascript theme={null} console.log("Request:", JSON.stringify(requestData, null, 2)); console.log("Response:", JSON.stringify(response, null, 2)); ``` Verify API access outside your application ```bash theme={null} curl -X POST https://api.nordlyslabs.com/v1/chat/completions \ -H "Authorization: Bearer apk_123456" \ -H "Content-Type: application/json" \ -d '{"model":"nordlys/hypernova","messages":[{"role":"user","content":"test"}]}' ``` Systematically narrow down the issue: * Test different messages * Try different parameters * Test in different environments * Compare with working examples ## Complete Error Handling Example Here's a production-ready error handling implementation: ```javascript theme={null} class NordlysClient { constructor(apiKey) { this.openai = new OpenAI({ apiKey: apiKey, baseURL: 'https://api.nordlyslabs.com/v1' }); } async createCompletion(params, retries = 3) { for (let attempt = 1; attempt <= retries; attempt++) { try { const completion = await this.openai.chat.completions.create({ model: "nordlys/hypernova", ...params }); // Log success metrics console.log(`✅ Success: ${completion.usage.total_tokens} tokens`); return completion; } catch (error) { // Handle specific errors if (error.status === 401) { throw new Error('Invalid API key - check your credentials'); } if (error.status === 429) { const delay = Math.min(1000 * Math.pow(2, attempt), 10000); console.log(`⚠️ Rate limited, retrying in ${delay}ms (attempt ${attempt}/${retries})`); if (attempt < retries) { await new Promise(resolve => setTimeout(resolve, delay)); continue; } throw new Error('Rate limit exceeded - reduce request frequency'); } if (error.status === 400) { throw new Error(`Invalid request: ${error.message}`); } if (error.status >= 500) { const delay = 1000 * attempt; console.log(`🔄 Server error, retrying in ${delay}ms (attempt ${attempt}/${retries})`); if (attempt < retries) { await new Promise(resolve => setTimeout(resolve, delay)); continue; } throw new Error('Server error - try again later'); } // Unexpected error throw new Error(`Unexpected error: ${error.message}`); } } } } // Usage example const client = new NordlysClient(process.env.NORDLYS_API_KEY); try { const response = await client.createCompletion({ messages: [{ role: "user", content: "Hello!" }], model: "nordlys/hypernova" }); console.log("Response:", response.choices[0].message.content); } catch (error) { console.error("Failed to get completion:", error.message); } ``` ## FAQ Use the model ID in your request: ```javascript theme={null} model: "nordlys/hypernova" ``` Check the `model` field in the response: ```javascript theme={null} console.log("Model used:", completion.model); ```