Docs · Integration

Add to magpie

Hand your users one link, and your models show up in every agent they run: Claude Code, Codex, OpenCode, Gemini CLI, Pi, Crush. No config files, no environment variables, no copy-pasting base URLs.

magpie asking whether to add Acme Relay, with the hosts, key and models from the link magpie asking whether to add Acme Relay, with the hosts, key and models from the link
What your user sees. Nothing is saved until they press Add.

Quick start

  1. Build a linkDescribe your endpoint as URL parameters: a name, a base URL per API you speak, and optionally the user’s key and the models to offer.
  2. Put it behind a buttonOn your dashboard, next to the key you just minted: Add to magpie.
  3. The user confirmsmagpie opens, shows exactly where prompts and the key will go, and adds the provider when the user says yes. Every agent can use it right away.
Link
https://usemagpie.ai/import#name=Acme%20Relay&chat=https://api.acme.example/v1&anthropic=https://api.acme.example&key=sk-…&models=gpt-5.5,claude-sonnet-5

magpie registers the magpie:// scheme with the system. An import link is that scheme, the word import, and a query string:

magpie://import?name=Acme%20Relay&chat=https://api.acme.example/v1&key=sk-…

On the web, link to the same parameters on usemagpie.ai/import instead, after a #:

https://usemagpie.ai/import#name=Acme%20Relay&chat=https://api.acme.example/v1&key=sk-…

Why the https link

It works everywhere a link does: GitHub READMEs, chat apps and email clients drop or block custom schemes. It opens magpie, and offers the download when magpie isn’t installed yet.

Why after the #

Browsers never send the fragment to a server. The key goes from your page to the user’s machine without passing through usemagpie.ai, not even its logs.

Every value is URL-encoded, as URLSearchParams or urlencode produce. Both %20 and + work for spaces.

Parameters

A link either names one of magpie’s presets, which already knows the vendor’s endpoints, or describes a provider from scratch with a name and at least one base URL.

ParameterMeaning
nameor presetWhat the provider is called in magpie, at most 80 characters.
chatOpenAI Chat Completions base URL, ending in /v1 (magpie appends /chat/completions).
responsesOpenAI Responses base URL, ending in /v1. Codex speaks only this API; magpie translates for it when you don’t.
anthropicAnthropic Messages base URL: the root, without /v1.
keyThe user’s API key. Leave it out and the user pastes one in the dialog.
modelsModel ids to offer the agents, comma separated. Without it, magpie lists the models your /v1/models returns.
idThe id agents use in id/model. Defaults to the name, lowercased with dashes (Acme Relayacme-relay).
catalogA models.dev provider id whose metadata applies (display names, context sizes, reasoning levels), e.g. openai for a relay of OpenAI models.
websiteYour site (https). Shown on the provider’s page.
keysThe page where users make keys (https). The dialog links to it when the link has no key.
iconA picture of your own (https): PNG, JPEG, GIF, WebP, ICO or SVG, at most 1 MB. magpie downloads it once, after the user confirms the import, and keeps it beside the provider. Without one, magpie shows the catalog vendor’s logo or a plain mark.
presetor nameA preset id; its endpoints, catalog and pages are used, and name may rename it.
regionWith a preset that has regions, which one.

At least one of chat, responses and anthropic is required without a preset; give every API you speak, and each agent uses the one it speaks natively. Base URLs must be https, except plain http to localhost, loopback, private addresses and *.local, where model servers usually run without TLS. They can’t carry a query, a fragment or credentials.

Presets

Vendors magpie already knows. magpie presets prints the current list.

anthropicopenaigoogledeepseekxaimoonshotKimimoonshot-cnzhipuGLMzaiminimaxminimax-cnqwenqwen-cnmistralgroqopenrouteropencode-goopencode-zentogetherfireworkssiliconflowaihubmix302aiyylxauto · global · cnollamalmstudio

A vendor with a preset only needs to add the key: magpie://import?preset=deepseek&key=sk-…. Want yours on the list? Open an issue.

Link builder

Fill in your endpoint; the link, the button and the Markdown follow as you type. Everything stays in this page.

Web link
App link
HTML
Markdown
Try itOpens magpie; nothing is added until you confirm.

The button

Two ready-made badges, one for light pages and one for dark. Link them to your import link, or draw your own button: the words Add to magpie and the bird are yours to use.

Add to magpie
Add to magpie
HTML
<a href="https://usemagpie.ai/import#preset=deepseek&key=sk-…">
  <img src="https://usemagpie.ai/img/add-to-magpie.svg" alt="Add to magpie" width="176" height="40">
</a>
Markdown
[![Add to magpie](https://usemagpie.ai/img/add-to-magpie.svg)](https://usemagpie.ai/import#preset=deepseek)

For dark pages, use add-to-magpie-light.svg. A public page like a README should never carry a key; leave key out and the user pastes their own.

From your backend

The natural place for the button is the page that shows a freshly minted key. Build the link where you have it:

JavaScript
const params = new URLSearchParams({
  name: "Acme Relay",
  chat: "https://api.acme.example/v1",
  anthropic: "https://api.acme.example",
  key: apiKey,
  models: ["gpt-5.5", "claude-sonnet-5"].join(","),
  icon: "https://acme.example/logo.svg",
});
const href = "https://usemagpie.ai/import#" + params;
Python
from urllib.parse import urlencode

href = "https://usemagpie.ai/import#" + urlencode({
    "name": "Acme Relay",
    "chat": "https://api.acme.example/v1",
    "anthropic": "https://api.acme.example",
    "key": api_key,
    "models": "gpt-5.5,claude-sonnet-5",
    "icon": "https://acme.example/logo.svg",
})
Terminal
magpie import 'magpie://import?preset=deepseek&key=sk-…'   # asks first; -y to skip

Security

An import link is a suggestion. The user decides.

Keys in links are secrets. Put a key in a link only on a page that user alone sees, and prefer a key minted for magpie that they can revoke. Never put a shared key in a public link.

Platforms

SystemHow magpie:// gets registered
macOSBy the app itself, as soon as magpie.app is in Applications.
WindowsFor the current user, the first time magpie runs.
LinuxBy a desktop entry (x-scheme-handler/magpie), written by the installer and again on first run.
Terminalmagpie import <link> shows the same summary and asks before adding.

Import links need magpie 0.1.8 or later. When magpie is already running, the link goes to that instance and its window comes forward.