Add an OpenAI-compatible provider in Zed with the existing llama.cpp server’s loopback base URL ending in /v1 and the exact model ID it serves. In a fresh Zed Agent thread using the Minimal profile, select that provider, send a small text prompt, and confirm the server received the request.
Identify the server, model and context limit
Start with Zed and a working llama.cpp server on the same Mac. This guide covers a direct server with a loaded text chat model. Use the host and port shown by your existing server. The example uses port 8080. On your machine the port can be different, so write down the address before configuring Zed. A loopback address such as 127.0.0.1 points the client at the same Mac. Keep the server configured for that interface for this workflow. llama.cpp server endpoints
You will need the exact model ID from the server’s OpenAI-compatible model list and the total context window available to a chat request. A model filename, a friendly label, and the value accepted by the API can differ. For example, the server owner may have assigned an alias. The available runtime window can also differ from the maximum documented in the model card. Check the window of the running server with the person who configured it or from its startup information. Use that active limit when entering Zed’s context window.
Keep the first thread free of project context. Use a small text model that you already know can return a chat answer, and prepare a synthetic prompt such as Reply with the code ZED MAPLE 42 and nothing else. There is no need to send a real file or source tree to test a provider connection. If the editor is already open on a work project, open a blank window for the exercise.
Confirm the server is responding before opening Zed settings
On the Mac that is running the server, open Terminal. Replace the example port with the one you recorded. This health check helps distinguish a server that is still starting from an editor configuration issue.
curl --noproxy 127.0.0.1 -sS http://127.0.0.1:8080/health
Look for the ready status documented by llama.cpp. If the server reports that the model is still loading, wait for it to finish and run the same check again. If the command cannot connect, inspect the running server’s address and port before changing anything in Zed. An application UI can be open while its separate HTTP server has yet to start.
Next, read the model list:
curl --noproxy 127.0.0.1 -sS http://127.0.0.1:8080/v1/models
If your server requires a bearer token, use a token issued specifically for that server. For an existing token already available in your shell as LOCAL_LLAMA_TOKEN, the model list check is:
curl --noproxy 127.0.0.1 -sS \
-H "Authorization: Bearer $LOCAL_LLAMA_TOKEN" \
http://127.0.0.1:8080/v1/models
Copy the id of the configured text model from the returned list. In the sample below that value is my-local-text-id. Replace it with the exact ID from your server, keeping its case and punctuation. The entire model list path is useful in Terminal, while Zed expects the shorter base URL, including /v1 and ending before /models. Write both values down in separate places so they are easy to distinguish.
Test one direct chat reply when isolating the editor
Model discovery lists what is available. If you need a clean comparison with Zed, send a direct text request before you configure the provider. Use the exact ID from discovery in the JSON. If access is authenticated, add the same local Authorization header used for the model list.
curl --noproxy 127.0.0.1 -sS \
-H 'Content-Type: application/json' \
--data '{"model":"my-local-text-id","messages":[{"role":"user","content":"Reply with TERMINAL MAPLE 18 only."}],"max_tokens":32,"stream":false}' \
http://127.0.0.1:8080/v1/chat/completions
Check the reply’s first choice for TERMINAL MAPLE 18. Pay attention to whether you received a complete chat response or an error object. If the direct request is rejected, the server’s message gives you a smaller problem to solve before opening Zed. If it succeeds, send the different Zed code later so you can recognize which request is which in the logs. This direct test uses a short single response. Zed may stream the reply, and each client can add its own instruction text. A working direct request narrows routing problems without showing how the editor will handle project context.
Add the custom provider to Zed
In Zed, run agent: open settings from the command palette and find LLM Providers. Choose Add Provider, use the OpenAI-compatible provider type, and give it a name that identifies the server. Enter the loopback base URL, the model ID you copied, and the context window available on that server. A display name such as Local llama.cpp Text makes the provider easier to spot in the model list. Zed’s instructions for OpenAI-compatible providers
You can also merge the following example into your Zed user settings. Keep your existing settings and merge the new provider into the existing maps if they are already present. Replace the port, ID and context window with the values for your server. The example number is a client context setting for a server configured to handle 4,096 tokens per request.
{
"language_models": {
"openai_compatible": {
"mac-llama": {
"api_url": "http://127.0.0.1:8080/v1",
"available_models": [
{
"name": "my-local-text-id",
"display_name": "Local llama.cpp Text",
"max_tokens": 4096,
"capabilities": {
"tools": false,
"max_tokens_parameter": true
}
}
]
}
}
}
}
Zed uses the model’s context configuration to plan the conversation. The max_tokens_parameter capability tells Zed which field to use when it sends an output limit to a chat-completions endpoint. The tools setting is off for this text-only check. Start with a short answer to leave room for Zed’s request overhead and the response.
If Zed prompts for an API key and the local server requires one, enter the local credential in the provider settings panel. If the server administrator explicitly made it unauthenticated and Zed still needs a nonempty client value, use a local placeholder for this loopback provider. Zed saves provider credentials entered through its UI in the system keychain. Keep credentials out of the settings JSON and out of shared projects. Zed also reads provider-specific variables, so a stale variable for this provider can take precedence over the saved key. Zed’s provider credential rules
Prove the selected Zed thread uses that model
Open Zed’s Agent Panel, start a new thread, and pick Minimal from the profile menu. Select Local llama.cpp Text, or your chosen display name, in the thread’s model picker. Check that the provider belongs to the loopback connection you just added. A configured provider being visible in Settings is a separate step from selecting it for a thread. Zed Agent profiles · Zed Agent Panel
Send the ZED MAPLE 42 prompt. Check that the thread shows a complete answer with the expected code. At the same time, look at the local server console or request log, if available, for a chat-completions request at the moment you sent it. The code checks that the response used the prompt you typed. The selected provider and server-side activity give you evidence of which endpoint handled it.
If the server serves more than one application, repeat once with a different code and send the prompt when other local clients are idle. Match the time of the request with the action in Zed. Keep the test short and keep the fresh thread free of attachments. When it works, record the base URL, model ID, model role, context setting and which thread profile you used. That is enough information to repeat the check without saving a key or a private prompt.
Keep the first check separate from a working project
If you go back to an existing thread, look at the selected provider again. Zed can remember an earlier model choice in a thread. A profile may also define a default model for future conversations. Keep a clean test thread available and open it on the Mac whenever the provider configuration changes. If a model appears with the same display name under two providers, consult the actual provider entry or use a distinct display label while checking it.
Suppose the short test passes and a project thread immediately hits the context limit. Revisit what was sent in the project thread. Prior replies, long pasted text, and other attached information all compete for the window. A useful next check is to create a fresh thread and pass just one short synthetic paragraph, then compare it with the clean test. Keep the profile fixed so the amount of conversation is the main change. Record which of those cases passed and check the selected model before making any attribution about the failure.
Find whether the failure is in the server or the editor
- Both Terminal requests fail. Confirm the server port first, then whether the request is still going to the same Mac. A loopback address in a process always refers to the machine running that process. Run the direct check from the host Mac.
- Health succeeds and model discovery is refused. Check whether the endpoint expects authentication. Use the local server’s credential and check the response again. Confirm that the path ends in
/v1/models. A ready server can still reject a request without the proper credential. - The model is visible and Zed rejects the request. Compare the requested model ID with the exact entry in the server list. Check that Zed’s URL stops at
/v1. If the server logs an unsupported field or context error, use the text-only profile, start a fresh thread, and recheck the context value and capability settings. - A reply appears with no matching activity in the local log. Check the thread’s selected model and provider. If the server has access logging available, use its next matching request as your confirmation. A plausible response alone gives little evidence about where it ran.
- The short test works and a long thread fails. Repeat the first prompt in a clean thread. If it works there, inspect the amount of history and any project context attached to the longer request. Check the real server allocation before increasing the client window.
When you change the served model, recheck the model list and context window before reusing the saved provider. Keep this text connection separate from any evaluation of code tools, editing permissions, or model quality. For details on identifying the upstream local server, use the existing server guide. llama.cpp server setup on Mac