Skip to main content

Emacs with the Gateway

Use an Emacs package that lets you set an OpenAI-compatible host and endpoint. This guide uses gptel. Its backend configuration shows the protocol, host, endpoint, API key, and model list.

GitHub Copilot packages use the GitHub service and authentication flow. Do not set HTTP_PROXY or HTTPS_PROXY to the Verdictan gateway. This setting does not make that traffic OpenAI-compatible. Verdictan does not support this setting.

Prerequisites

  • Complete Gateway Setup for IDEs, including a named gateway runtime.

  • Configure a provider target for the model you plan to use.

  • Create a client API token.

  • Before you start Emacs, export it:

    export VERDICTAN_IDE_TOKEN="vdt_..."

The client token authenticates Emacs to the gateway. It is different from the connected gateway runtime token. It is also different from the upstream provider credential.

Configure gptel

Add a backend to your Emacs configuration:

(use-package gptel
:config
(setq gptel-backend
(gptel-make-openai "Verdictan"
:protocol "http"
:host "127.0.0.1:41002"
:endpoint "/v1/chat/completions"
:key (lambda () (getenv "VERDICTAN_IDE_TOKEN"))
:models '(your-model-id)
:stream t)
gptel-model 'your-model-id))

Replace your-model-id with an ID from the authenticated /v1/models route. The entry in :models tells gptel which model names to offer. It does not create or enable an upstream target.

After you change its environment, start Emacs again. Select the Verdictan backend. Send a prompt with the gptel workflow.

Verify the governed path

First, send an authenticated model-catalog request to the gateway:

curl -fsS \
-H "Authorization: Bearer $VERDICTAN_IDE_TOKEN" \
http://127.0.0.1:41002/v1/models

Then follow events while you send a prompt from gptel:

verdictan events tail --since 10m --follow

A matching event proves that the request went through Verdictan. If no event is available, first verify gateway event delivery. Then verify the CLI organization, region, event time window, and filters. Then verify the active gptel backend and endpoint.

Other Emacs packages

A different package can use the same gateway only if it exposes all of these settings:

  • an OpenAI-compatible base URL or chat-completions endpoint
  • bearer-token authentication
  • a specified model identifier
  • streaming support for a package that must stream

Package options change independently of Verdictan. Examine the package documentation. Verify the result with verdictan events tail. Do not infer support from an operating-system proxy setting.

Troubleshooting

SymptomCheck
Connection refusedMake sure that verdictan gateway status and port 41002 are correct.
401 UnauthorizedMake sure that Emacs inherited VERDICTAN_IDE_TOKEN and that the token is active.
Model unavailableMake sure that the requested model is available in GET /v1/models and in the configured provider targets.
No Verdictan eventSelect the Verdictan backend again. Examine gptel's active host and endpoint.

Next steps