How Magpie connects to APIYI
Magpie is an open-source application for managing models and providers for AI coding tools. After adding APIYI to Magpie, you can choose models for Codex, Claude Code, and other tools in one interface. Magpie writes the settings to each tool’s configuration files. Requests pass through a local gateway before reaching APIYI:127.0.0.1:3425 by default. Keep Magpie running while using the tools.
Project: github.com/yetone/magpie; official getting started guide: usemagpie.ai/docs/start.
Before you start
- Download the desktop app for macOS, Windows, or Linux from
usemagpie.ai, then install and open it. - Install the coding tool you want to use. See the installation sections of the Codex configuration guide or Claude Code configuration guide.
- Prepare API keys on the APIYI token page. Confirm that your account has an available balance and the tokens can access your selected models.
ClaudeCode group for the second. Magpie treats configurations that use the same key on the same host as duplicate providers.
Configure through the desktop interface
Configure the provider for Codex
Add a custom provider
/v1. Magpie appends the request path, so do not enter the full /chat/completions path.Add a Responses endpoint for GPT models
https://api.apiyi.com/v1.This guide uses gpt-5.4, which supports both Chat Completions and Responses on APIYI. Codex can use the Responses endpoint when accessing this model through Magpie.Only configure an endpoint when APIYI supports that protocol for the selected model. Responses support in Magpie’s local gateway does not mean every model on APIYI supports native Responses.Fetch and select a model
gpt-5.4 from the model list, and save the provider.Select only this model for the initial setup. Before adding other GPT models, confirm that they support the same endpoints on APIYI. Do not add image, embedding, or other non-chat models to your coding tools’ model lists.If the model you need is missing from the list, add its exact model ID manually under Models. Enter gpt-5.4 in the provider’s model field without the apiyi/ prefix.Configure the provider for Claude Code
Add another Custom provider using a different token from theClaudeCode group:
/v1. Magpie appends /v1/messages. After fetching models, select only the Claude model you plan to use. You can also enter claude-sonnet-4-6 manually, then save.
Select a model for each coding tool
- Open Agents and find your installed Codex or Claude Code tool.
- Click the tool’s current model, then find and select the model under the provider you just added: APIYI → gpt-5.4 for Codex, or APIYI Claude → claude-sonnet-4-6 for Claude Code.
- Close the tool’s old session, restart it, and open a new session so it reads the configuration written by Magpie.
provider-id/model-id, such as apiyi/gpt-5.4. The raw model ID entered in the provider form and the full identifier selected for an agent serve different purposes.
Verify the connection
Run a test on the provider page first, then send a short request from your coding tool, for example:Configure through the CLI
If you prefer the terminal, use the following commands instead of adding providers through the interface. First, confirm that themagpie command is installed and keep the desktop app running.
provider add again. Run magpie providers to check their actual provider IDs, then substitute those IDs in the test or model-selection commands. IDs created through the interface are generated from provider names; id= in a command requests a particular ID. If an ID is already taken, Magpie may add a suffix, so check the actual IDs after adding providers through the CLI too.Add the two providers
Replacesk-your-api-key in the first command with your token for GPT models:
sk-your-api-key in the second command with a different token from the ClaudeCode group:
List models and connect the tools
Test the upstream providers and local gateway
provider test sends a small number of real requests to the configured upstream endpoints. healthcheck only checks the local gateway, so it cannot by itself confirm that model requests to APIYI work.
Troubleshooting
Authentication fails with 401 or 403
Authentication fails with 401 or 403
ClaudeCode group for the Claude Code configuration. Changing terminal environment variables does not automatically update a key already saved in Magpie; edit and save the provider instead.Requests return 404 or an endpoint-not-found error
Requests return 404 or an endpoint-not-found error
https://api.apiyi.com/v1 for OpenAI compatible and Responses, and https://api.apiyi.com for Anthropic compatible. Do not append the full request path. Confirm that the target model supports the endpoint, and do not configure a Responses endpoint for a model that only supports Chat Completions.The model list loads, but the model is missing from Agents
The model list loads, but the model is missing from Agents
magpie models to see the models currently exposed by Magpie. When adding a model manually, check its raw model ID; when selecting it for a tool, check the provider prefix and ID.Adding the second provider produces a duplicate warning
Adding the second provider produces a duplicate warning
A tool is missing from Agents, or a new model still uses the old configuration
A tool is missing from Agents, or a new model still uses the old configuration
Coding tools cannot connect after Magpie is closed
Coding tools cannot connect after Magpie is closed
magpie healthcheck to check whether the local gateway is online.Model selection and related resources
The model IDs in this guide demonstrate the configuration process. Confirm endpoint support and token permissions before adding other models. Current model recommendations and prices are maintained on the following pages.Model recommendations
Model prices
Codex configuration guide
Claude Code configuration guide
github.com/yetone/magpie/blob/main/docs/reference.md. The configuration steps in this guide were checked against the project documentation and source code. Verify model listing, streaming, and tool calling with actual requests using your selected model and protocol.