> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Jev

> Connect Jev's structured decision API to TrueFoundry's AI Gateway using Custom Endpoints.

[Jev](https://www.jevai.org/jev-api) returns structured decisions, probabilities, and scores. Use [Custom Endpoints](/docs/ai-gateway/custom-endpoints) to keep your Jev credentials on the AI Gateway and call its API with a TrueFoundry API key, access control, and tracing.

### Prerequisites

* Sign in to Jev and create a personal API key on the [API keys page](https://www.jevai.org/agent/keys).
* Get your **TrueFoundry API key** and **gateway base URL**. See [Authentication](/docs/ai-gateway/authentication) and [Gateway base URL](/docs/ai-gateway/quick-start#gateway-base-url).

### Adding an endpoint

<Steps>
  <Step title="Create a Custom Endpoint model account">
    In the TrueFoundry dashboard, go to **AI Gateway** → **Models** → **Custom Endpoints** and click **Add Custom Endpoint**.

    In **Configure Account**, set:

    * **Name**: `jev-account`
    * **Endpoint Type**: `Other`
    * **Header Auth**: leave disabled at the account level; configure it on the endpoint below.

    Click **Continue to Endpoints**.
  </Step>

  <Step title="Add the Jev endpoint">
    Add an integration with:

    * **Display Name**: `jev-endpoint`
    * **Base URL**: `https://www.jevai.org` (no trailing slash)

    Enable **Header Auth** and add:

    | Header          | Value                  |
    | --------------- | ---------------------- |
    | `Authorization` | `Bearer <JEV_API_KEY>` |

    Replace `<JEV_API_KEY>` with your Jev key. The AI Gateway injects this header when forwarding requests to Jev. Client applications send their **TrueFoundry API key** to the gateway.
  </Step>

  <Step title="Set access control and save">
    On the **Access Control** step, choose the users or teams who can manage and use this model account, then **Save**. See [Gateway access control](/docs/ai-gateway/gateway-access-control).
  </Step>
</Steps>

### Making requests

The gateway appends the upstream path to the configured Base URL:

```text theme={"dark"}
{GATEWAY_BASE_URL}/proxy-api/jev-account/jev-endpoint/api/v1/decisions/tool-guard
```

This forwards to `https://www.jevai.org/api/v1/decisions/tool-guard`. Here, `jev-account` is the account name and `jev-endpoint` is the endpoint Display Name. The remaining `/api/v1/decisions/tool-guard` path belongs to the Jev API. Replace these segments if you chose different names. See [Endpoint structure](/docs/ai-gateway/custom-endpoints#endpoint-structure).

<Note>
  Use the HTTPS `www.jevai.org` host and `/api/v1/decisions` routes from the [Jev REST reference](https://www.jevai.org/docs). Jev uses its own request schema rather than `/chat/completions`. Request bodies are limited to 32 KiB.
</Note>

### Supported APIs

All paths below are appended to `/proxy-api/jev-account/jev-endpoint` and use `POST`. Custom Endpoint requests support [tracing](/docs/ai-gateway/request-logging); cost tracking is unavailable.

| API               | Upstream path                   |
| ----------------- | ------------------------------- |
| Tool guard        | `/api/v1/decisions/tool-guard`  |
| Model routing     | `/api/v1/decisions/model-route` |
| Task routing      | `/api/v1/decisions/route`       |
| Research check    | `/api/v1/decisions/research`    |
| Completion review | `/api/v1/decisions/completion`  |
| Native decisions  | `/api/v1/decisions`             |

See the [Jev REST reference](https://www.jevai.org/docs) for each request schema.

### Example: evaluate a tool call

The tool-guard API evaluates a proposed action and returns `allow`, `confirm`, `review`, or `deny`. It does not execute the tool.

Set `GATEWAY_BASE_URL` to your gateway base URL without a trailing slash and `TFY_API_KEY` to your TrueFoundry API key. For Python, install `requests` with `pip install requests`.

<CodeGroup>
  ```python Python lines theme={"dark"}
  import os

  import requests

  gateway_base_url = os.environ["GATEWAY_BASE_URL"].rstrip("/")
  response = requests.post(
      f"{gateway_base_url}/proxy-api/jev-account/jev-endpoint/api/v1/decisions/tool-guard",
      headers={"Authorization": f"Bearer {os.environ['TFY_API_KEY']}"},
      json={
          "tool": "delete_project",
          "action": "Delete an archived project and its stored files",
          "side_effects": ["Permanently removes project files"],
          "policy": ["Project deletion requires the owner's approval"],
      },
      timeout=60,
  )
  response.raise_for_status()
  result = response.json()
  if result["code"] != 0:
      raise RuntimeError(f"Jev request failed: {result['message']}")

  print(result["data"])
  ```

  ```bash cURL theme={"dark"}
  curl --fail-with-body -X POST "${GATEWAY_BASE_URL}/proxy-api/jev-account/jev-endpoint/api/v1/decisions/tool-guard" \
    -H "Authorization: Bearer ${TFY_API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
      "tool": "delete_project",
      "action": "Delete an archived project and its stored files",
      "side_effects": ["Permanently removes project files"],
      "policy": ["Project deletion requires the owner\u0027s approval"]
    }'
  ```
</CodeGroup>

Jev wraps responses in `code`, `message`, and `data`; `code: 0` indicates success. Inspect `data.decision` and the returned confidence and probabilities before handling the result. Keep action approval and execution in your application. See [Jev's response documentation](https://www.jevai.org/docs).
