vinilana/jev-gateway

An easy way to use jev with your coding agent for tool calling reasoning

What is jev-gateway?

jev-gateway is a local tool that sits between your coding agent (like Codex or Claude Code) and the AI model it normally talks to. Its job is to make a small, fast AI model named Jev decide which tool the agent should call before the agent's main (expensive) model does. This saves money and time because Jev is quick and cheap.

It works with Codex, Claude Code, OpenCode, Kilo, Gemini CLI, and Devin out of the box. It also works with any client that speaks the OpenAI, Anthropic, or Google Gemini APIs.

Important: This is an independent project, not affiliated with TypeSafe (the makers of Jev). It simply uses Jev's public API.


How it works

When your agent is about to decide which tool to call (e.g., apply_patch, read_file, etc.), the gateway asks Jev for a recommendation. If Jev is confident, the gateway nudges the main model to use that tool. If Jev is unsure, the request goes through unchanged. If Jev is down, slow, or your key is wrong, the gateway simply forwards the request to the main model without asking Jev – it never makes a request fail.

The gateway runs locally on your machine and only listens on 127.0.0.1 (your own computer). It does not change your existing agent configuration – your normal codex, claude, etc. still work exactly as before. Only sessions started with the jev- commands go through the gateway.


Quick start

Requirements: Node.js 22.15 or newer, a Jev API key (from TypeSafe, OpenRouter, Vercel AI Gateway, or OpenCode), and one of the supported agents already installed and logged in.

  1. Install globally:

    npm install -g jev-gateway
    
  2. Run your agent through the gateway – use the jev- prefix instead of the normal command:

    jev-codex      # like `codex`
    jev-claude     # like `claude`
    jev-opencode   # like `opencode`
    jev-kilo       # Kilo CLI
    jev-gemini     # Gemini CLI
    jev-devin      # like `devin`
    
  3. First-time setup: The launcher asks where you want to reach Jev (TypeSafe, OpenRouter, Vercel, or OpenCode) and for your API key. It verifies the key with one real call, saves it to ~/.jev-gateway/.env (readable only by you), and then starts your agent. You only do this once – all jev- commands share that file.

  4. Watch it work:

    jev-codex --dashboard
    

    This opens a monitoring dashboard in your browser.


Commands

All commands work with any of the jev- launchers (e.g., jev-codex, jev-claude, etc.).

Command What it does
jev-codex [args] Start the gateway if needed, then run Codex through it. All arguments pass through.
jev-codex --dashboard Open the monitoring dashboard in your browser.
jev-codex --routing off Baseline mode: stop asking Jev, but keep counting tokens (for comparison).
jev-codex --routing on Let Jev decide again (default).
jev-codex --status Check if the gateway is healthy and show configuration.
jev-codex --logs Follow routing decisions live (use a second terminal).
jev-codex --start Start the gateway without opening the agent.
jev-codex --stop Stop the background gateway (close your sessions first).
jev-codex --setup Change where you reach Jev or update the key.
jev-codex --print-config Print settings to point plain codex at the gateway permanently.
jev-codex --gateway-help List all of the above.

Each agent uses a different port (Codex: 8790, Claude: 8789, OpenCode: 8791, Gemini: 8788, Devin: 8792, Kilo: 8793). You can change them with environment variables like JEV_CODEX_PORT.


Dashboard

Run jev-codex --dashboard (or any other launcher) to open a web page at http://localhost:8790/dashboard (or the appropriate port). It shows:

  • Status per gateway – Routing, Passthrough only, Jev is failing, Idle, Baseline, Shadow evaluation, or Offline, with a one-line explanation.
  • Why requests were not routed – each reason explained in plain English.
  • Jev's numbers – calls, latency, confidence, and cost.
  • LLM tokens – input (including cache share), output (including hidden reasoning), and seconds per request.
  • A live table of recent requests (appears when a reply finishes because that's when tokens are reported).

The dashboard only shows metadata – prompts, tool arguments, and credentials never reach it.

Compare with a baseline

Turn routing off (--routing off) to measure the same work without Jev. The gateway still forwards and counts tokens but never asks Jev. Then turn it back on (--routing on) and do a similar task. The dashboard shows both states side by side.

Shadow evaluation (test without applying)

You can run Jev in shadow mode – it records what Jev would do but changes nothing. The request goes to the LLM exactly as sent, and Jev's proposal is logged for comparison. This is useful to evaluate Jev's decisions without affecting your work.

To enable shadow mode:

jev-codex --stop
JEV_SHADOW=true jev-codex --start

In shadow mode, the request does not wait for Jev – Jev runs alongside. A slow or failing Jev never touches the reply. Jev still costs tokens (one call per request, two for long tool lists). The dashboard labels the state "Shadow evaluation".


Where Jev runs (providers)

Jev is served by TypeSafe and three resellers. All accept the same questions and return the same answers – the choice is about which account/billing you prefer.

Provider Key variable Default model Get a key
TypeSafe (official) TYPESAFE_API_KEY jev-latest typesafe.ai
OpenRouter OPENROUTER_API_KEY typesafe/jev-1.14 openrouter.ai/settings/keys
Vercel AI Gateway AI_GATEWAY_API_KEY typesafe-ai/jev Vercel dashboard
OpenCode OPENCODE_API_KEY jev-1.13-free OpenCode Zen

You can switch providers with --setup or by setting JEV_PROVIDER and the matching key in ~/.jev-gateway/.env or your environment. Without JEV_PROVIDER, the gateway uses whichever key it finds (TypeSafe first). JEV_MODEL lets you pick a specific model version.

Note: The TypeSafe and OpenCode paths have been tested against real APIs. OpenRouter and Vercel follow published endpoints but haven't been tested with real keys yet – the first-run key check will tell you immediately if something's wrong.


Using it with specific agents

Codex

jev-codex reuses your existing Codex login. With a ChatGPT subscription it forwards to https://chatgpt.com/backend-api/codex; with an API key it forwards to https://api.openai.com/v1. You can override with JEV_CODEX_UPSTREAM_BASE_URL. The gateway handles Codex's Responses API, including free-form tools like apply_patch and compressed request bodies. If the backend rejects a rewritten request, the gateway resends the original – so Codex never sees an error caused by the gateway.

Claude Code

jev-claude runs claude with only ANTHROPIC_BASE_URL set. Your saved login (including claude.ai subscription) keeps working. Because of Anthropic API limitations, Jev can't force a tool while extended thinking is on, so the gateway adds a short suggestion to the request instead (hint mode) – the model is free to ignore it. Expect better tool picks on large tool lists, but not lower cost or latency.

OpenCode

Tested with stable OpenCode v1.18.31. The launcher injects a jev-gateway custom provider via OPENCODE_CONFIG_CONTENT – your ~/.config/opencode files are never modified. All OpenCode flags pass through.

Important: OpenCode chooses a provider per model. The launcher only makes the gateway model the default. Agents that specify their own model (in opencode.json or markdown) bypass the gateway. The launcher warns you about these before starting. To bring an agent under the gateway, give it a jev-gateway/<model> model or remove its model line.

Manual setup is possible with --print-config – it prints an opencode.json snippet you can save.

Kilo, Gemini, Devin

These are supported similarly – use the jev- prefix and they run through the gateway. Kilo uses free models unless KILO_API_KEY is set. Gemini requires a Gemini API key.


Security & privacy

  • The gateway listens only on 127.0.0.1 (your own machine).
  • Your API key is stored in ~/.jev-gateway/.env with permissions readable only by you.
  • The dashboard shows only metadata – never prompts, tool arguments, or credentials.
  • The gateway never sends your LLM credentials to Jev – Jev only gets the tool-selection question.

Summary

jev-gateway is a local proxy that uses the fast Jev model to make tool-selection decisions for your coding agent, saving cost and latency. It's easy to install, works with multiple agents, and includes a dashboard to monitor and compare performance. It's designed to be safe – if Jev fails, your requests just go through normally. It's an independent project, not affiliated with TypeSafe. For full details, see the README.

Related

  • Project
  • Dispatch
  • Dispatch
  • Project
  • Project