# New API / One-API One-Click Import Guide for Octopus

> Canonical HTML: https://octoterm.si/docs/integrations/new-api (ZH) · https://octoterm.si/en/docs/integrations/new-api (EN)
> LLMs index: https://octoterm.si/docs/llms.txt

**TL;DR:** New API and One-API administrators can enable one-click provider import into Octopus Desktop with zero code changes by adding one entry in **Settings → Chats**.

## 1. Zero-Code Admin Templates (`Settings → Chats`)

### Recommended — One Click, Multi-Protocol Fan-Out
Users click once and choose Anthropic (Claude Code), OpenAI Responses (Codex CLI), OpenAI Chat (OpenCode / Aider), and/or Gemini CLI sharing the same API key:

```json
[
  {
    "Octopus": "octopus://provider/import?v=1&baseUrl={address}&apiKey={key}&source=new-api"
  }
]
```

### Per-Protocol Buttons
```json
[
  {
    "Octopus · Claude Code": "octopus://provider/import?v=1&protocol=anthropic&baseUrl={address}&apiKey={key}&name=NewAPI-Claude&source=new-api"
  },
  {
    "Octopus · Codex CLI": "octopus://provider/import?v=1&protocol=openaiResponses&baseUrl={address}&apiKey={key}&name=NewAPI-Codex&source=new-api"
  }
]
```

### Zero-Leak Web Bridge (With Download Fallback for New Users)
```json
[
  {
    "Octopus": "https://octoterm.si/import/provider#v=1&baseUrl={address}&apiKey={key}&source=new-api"
  }
]
```

### Legacy `{cherryConfig}` Compatibility
```json
[
  {
    "Octopus": "octopus://provider/import?v=1&cherry={cherryConfig}&source=new-api"
  }
]
```

## 2. Step-by-Step Setup

1. Sign in to New API / One-API as an administrator and open **System Settings → Chat Settings (Chats)**.
2. Append the Octopus template object into the chat shortcuts JSON array and save.
3. Users open the **Tokens** page, click **Octopus** on any API key, and approve the browser prompt to launch Octopus Desktop.
4. In Octopus's confirmation modal, users verify the target hostname, select desired protocols, optionally test connectivity, and click **Confirm Import** to store the key in the OS keychain and fetch `/models`.

## 3. Frequently Asked Questions

**Q: Does New API need to URL-encode `{address}`?**
A: No. OPIP v1 tolerates raw unencoded `https://...` URLs in `baseUrl` and automatically strips or appends `/v1` depending on each protocol.

**Q: Does `https://octoterm.si/import/provider#...` send my users' API keys to `octoterm.si`?**
A: Never. By RFC 3986, browsers never transmit the URL `#fragment` to HTTP servers. The bridge page reads `window.location.hash` locally, clears it from the address bar via `history.replaceState`, and hands off straight to `octopus://provider/import?...`.
