# Claude Code

#### What is Claude Code?

Claude Code is an AI-powered coding assistant designed to help developers write, understand, and improve code more efficiently. Built on Anthropic’s Claude models, it provides interactive coding support directly within your development workflow. Claude Code can generate code, explain existing logic, refactor functions, create tests, and assist with debugging through natural-language interactions. It is commonly used to accelerate development, improve code quality, and support engineers in navigating complex codebases.

**Key features:**

* **Intelligent Code Generation**\
  Produces high-quality code snippets, functions, and modules based on natural-language prompts, helping developers move faster.
* **Code Explanation & Understanding**\
  Provides clear explanations of complex code blocks, libraries, or architectural patterns to improve comprehension and onboarding.
* **Refactoring & Optimization**\
  Suggests cleaner, more efficient, or more idiomatic implementations while preserving existing functionality.
* **Automated Test Creation**\
  Generates unit tests, integration tests, and edge-case scenarios to improve code reliability and coverage.
* **Debugging Assistance**\
  Helps identify potential bugs, logic issues, or problematic patterns and proposes fixes.
* **Documentation Support**\
  Creates or updates documentation, docstrings, READMEs, and comments directly from code.
* **Multi-Language Support**\
  Works across a wide range of programming languages, adapting to ecosystem conventions and best practices.
* **Context-Aware Development**\
  Uses project context (files, codebase structure, error logs) to deliver highly relevant responses.
* **Interactive Cooperative Workflow**\
  Works like a coding partner—developers can iterate, review, and refine code through conversational interactions.

To connect your nexos.ai **API** and **Claude Code** go through the following steps:

#### 1. Get Claude Code Router

```
npm install -g @anthropic-ai/claude-code
npm install -g @musistudio/claude-code-router
```

This installs both the official Claude Code CLI and the router proxy globally.

#### 2. Configuration

Create a config file at \~/.claude-code-router/config.json. It should look like this:

```
{
  "HOST": "127.0.0.1",
  "PORT": 3456,
  "API_TIMEOUT_MS": "600000",
  "Providers": [
    {
      "name": "nexosai",
      "api_base_url": "https://api.nexos.ai/v1/chat/completions",
      "api_key": "{YOUR_TEAM_API_KEY}",
      "models": [
        "claude-opus-4-1-20250805",
        "anthropic.claude-sonnet-4@20250514",
        "gpt-4.1",
        "or basically any model uuid/name that you want to use"
      ],
      "transformer": {
        "use": [
          "OpenAI"
        ]
      }
    }
  ],
  "Router": {
    "default": "nexosai,anthropic.claude-sonnet-4@20250514",
    "background": "nexosai,anthropic.claude-sonnet-4@20250514",
    "think": "nexosai,claude-opus-4-1-20250805",
    "longContext": "nexosai,anthropic.claude-sonnet-4@20250514",
    "longContextThreshold": 60000,
  }
}
```

All configuration options are available here: <https://github.com/musistudio/claude-code-router>

Most importart config options:

* Providers: defines one or more backend LLM providers (in our case, <http://nexos.ai> ) — specify name, api\_base\_url, api\_key, and models.
  * api\_base\_url is <https://api.nexos.ai/v1/chat/completions>
* Router: defines routing rules. The "default" rule indicates which provider/model combo to use when no special route is triggered.

#### 3. Start using it

```
ccr code
```

#### (Optional) Configuration via UI

Claude Code Router also provides a simple web-based UI that allows you to manage your provider configuration without manually editing the config.json file. After starting the router, you can open the browser interface (using ccr ui) to add new providers, update API keys, change model routing rules, or modify advanced settings such as transformers and logging.&#x20;

The UI presents all configuration options in a structured form and validates fields as you edit them, making it much easier to set up nexos.ai as a backend provider. Once changes are saved, the router automatically reloads the configuration, and Claude Code will immediately start using the updated settings.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexos.ai/gateway-api/integrations/claude-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
