EchoBirdDocs
Documentation/Open API

Model Import for Providers

Add an Import to EchoBird copy icon to your dashboard so customers can quickly import their model settings.New APISub2API

How import works

Model providers and gateways such as New API and Sub2API can place a copy icon next to each model with the tooltip “Import in EchoBird: Settings → General → Import Partner Link”. Users click it to copy the model link.

Start with echobird://models/add? and encode query parameters with URLSearchParams. Field names are case-sensitive. Supply both API addresses when your service offers both protocols. If your service offers one protocol, supply that address.

FieldRequiredValue
nameYesDisplay name in the model list.
modelIdYesThe exact model ID accepted by your API.
baseUrlOne or bothOpenAI-compatible base URL, e.g. https://api.example.invalid/v1.
anthropicUrlOne or bothAnthropic-compatible base URL, e.g. https://api.example.invalid/anthropic.
apiKeyOptionalThe current user’s API key. Omit it for keyless endpoints or to let the user enter it.

Addresses must use HTTP or HTTPS. Supply base URLs without embedded credentials, query parameters, or fragments.

Button example

Replace the sample model and API address with values from your service. On an HTTPS dashboard, generate the link with the signed-in user’s selected model and key.

<button type="button" id="copy-echobird"
  title="Import in EchoBird: Settings → General → Import Partner Link"
  aria-label="Import to EchoBird">
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none"
    stroke="currentColor" stroke-width="2" aria-hidden="true">
    <rect x="8" y="8" width="13" height="13" rx="2" />
    <path d="M16 5V4a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h1" />
  </svg>
</button>
<output id="echobird-copy-status"></output>
<script type="module">
  const params = new URLSearchParams({
    name: 'Example Gateway',
    modelId: 'example/model',
    baseUrl: 'https://api.example.invalid/v1',
    anthropicUrl: 'https://api.example.invalid/anthropic',
    apiKey: 'demo-key',
  });
  const link = 'echobird://models/add?' + params.toString();

  const copy = document.querySelector('#copy-echobird');
  const status = document.querySelector('#echobird-copy-status');
  copy.addEventListener('click', async () => {
    try {
      await navigator.clipboard.writeText(link);
      status.textContent = 'Link copied';
    } catch {
      status.textContent = 'Copy failed';
    }
  });
</script>

The sample fills both API address fields for Example Gateway, with model ID example/model. Use the sample addresses and key to verify the import and save flow.

A link that includes a key should be treated as a credential. Keep it in the signed-in dashboard and out of public pages, analytics, and logs.

New API and Sub2API setup

New API

Open web/src/features/keys/components/data-table-row-actions.tsx and search for Copy Connection Info in the API key row menu. Paste this code after that item and before the next <DropdownMenuSeparator />. The file already has the functions for reading the full key, copying text, and showing feedback. View the New API source

<DropdownMenuItem
  title="Import in EchoBird: Settings → General → Import Partner Link"
  disabled={isRealKeyLoading}
  onClick={async () => {
    const modelId = window.prompt("Enter the model ID to import")?.trim()
    if (!modelId) return

    const key = await resolveRealKey(apiKey.id)
    if (!key) return

    const root = getServerAddress().replace(/\/+$/, '').replace(/\/v1$/i, '')
    const params = new URLSearchParams({
      name: apiKey.name || modelId,
      modelId,
      baseUrl: root + '/v1',
      anthropicUrl: root,
      apiKey: key,
    })
    const link = 'echobird://models/add?' + params.toString()

    if (await copyToClipboard(link)) toast.success("Link copied")
    else toast.error("Copy failed")
  }}
>
  Import to EchoBird
  <DropdownMenuShortcut>
    <Copy size={16} />
  </DropdownMenuShortcut>
</DropdownMenuItem>

The example includes both OpenAI and Anthropic addresses. Test it with a model ID the current key can call. If your service offers one protocol for that model, remove the other address field.

For a Docker deployment, build the image from the source root. In your original deployment directory, set the new-api service’s image to new-api:echobird in your existing Compose file, then run docker compose up -d --no-deps new-api. Keep the same -f argument if you used one, along with your existing database, volumes, and environment settings.

docker build -t new-api:echobird .
Sub2API

Open frontend/src/views/user/KeysView.vue and search for openUseKeyModal(row) to find the Use Key button. Paste this button immediately after it. View the Sub2API source

<button
  v-if="row.group?.platform === 'openai' || row.group?.platform === 'anthropic'"
  type="button"
  title="Import in EchoBird: Settings → General → Import Partner Link"
  @click="importToEchoBird(row)"
  class="flex flex-col items-center gap-0.5 rounded-lg p-1.5 text-gray-500"
>
  <Icon name="copy" size="sm" />
  <span class="text-xs">Import to EchoBird</span>
</button>

In the same file, find const copyToClipboard = inside <script setup> and paste this function right after it ends. The button appears on keys in OpenAI and Anthropic groups and includes the API address for that group.

const importToEchoBird = async (row: ApiKey) => {
  const platform = row.group?.platform
  if (platform !== 'openai' && platform !== 'anthropic') return

  const modelId = window.prompt("Enter the model ID to import")?.trim()
  if (!modelId) return

  const root = (publicSettings.value?.api_base_url || window.location.origin)
    .replace(/\/+$/, '')
    .replace(/\/v1$/i, '')
  const params = new URLSearchParams({
    name: row.name || modelId,
    modelId,
    apiKey: row.key,
  })
  if (platform === 'openai') params.set('baseUrl', root + '/v1')
  else params.set('anthropicUrl', root)
  await clipboardCopy('echobird://models/add?' + params.toString(), "Link copied")
}

For a Docker deployment, build the image from the source root. In your original deployment directory, set the sub2api service’s image to sub2api:echobird in your existing Compose file, then run docker compose up -d --no-deps sub2api. Keep the same -f argument if you used one, along with your existing database, volumes, and environment settings.

docker build -t sub2api:echobird .