Quickstart

Get from zero to your first analysis result in a few minutes.


1. Create a project and API key

Log in to the Portal and create a new Project. Then go to Settings → API Keys, click Create a new API Key, and copy the key — it is only shown once.

Your key looks like: l2-3756a877ccc9c9f1-78debf03cb49...


2. Configure a model provider

Several features call an LLM on your behalf — the Instruction Adherence and Guardrails modules, Harmful Content classification, Red Teaming, and the Playground. Configure at least one LLM service so these features work.

Go to Settings → Models and:

  1. Click Add Provider and enter any OpenAI-compatible endpoint — a Name, the Base URL (e.g. https://api.openai.com/v1), and the provider API Key.
  2. Select the provider, click Add Model, and give it a Name and the exact Model ID (e.g. gpt-4o-mini).

See Models and Providers for details.


3. Define your application

An Application describes the LLM app you want to test and monitor. It is the target used by Red Teaming, the Playground, and the Instruction Adherence module.

Open Applications in the sidebar, click New Application, and fill in:

  • Name and Description.
  • Type — either an OpenAI-compatible API or a Chatkit server.
  • For an OpenAI-compatible app: select the Model (required, from step 2) and optionally provide a System Prompt, Temperature, and Additional Parameters (JSON).
  • For a Chatkit app: provide the Chatkit URL.

4. Enable at least one module

In the Portal, open your project's Module Configuration and set at least one module to Response mode. A good starting point:

Module Suggested mode
usage Response
harmful_content Response
malicious_intent Response

5. Make your first request

Analyze a user message

curl -X POST https://api.link2.ai/v1/analyzeInput \
  -H "Authorization: Bearer $LINK2AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "How do I reset my password?"}
    ],
    "model": "gpt-4o-mini"
  }'

Response

{
  "results": {
    "usage": {
      "status": "success",
      "secure": null,
      "duration_ms": 1.2,
      "result": {
        "input_tokens": 24,
        "output_tokens": null,
        "messages": [
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "How do I reset my password?"}
        ],
        "model": "gpt-4o-mini"
      },
      "cache_hit": null,
      "error_message": null
    },
    "harmful_content": {
      "status": "success",
      "secure": true,
      "duration_ms": 38.4,
      "result": {
        "categories": {
          "harassment": 0.0003,
          "violence": 0.0001
        }
      },
      "cache_hit": null,
      "error_message": null
    },
    "malicious_intent": {
      "status": "success",
      "secure": true,
      "duration_ms": 45.1,
      "result": {
        "message_labels": [
          {"label": "SAFE", "score": 0.999}
        ]
      },
      "cache_hit": null,
      "error_message": null
    }
  },
  "module_errors": false,
  "secure": true
}

The top-level secure: true means no security module flagged this interaction. Each module result also has its own secure field.


6. Analyze the LLM response

After you get a response from the LLM, send it back for output analysis. Include the full conversation including the assistant message:

curl -X POST https://api.link2.ai/v1/analyzeOutput \
  -H "Authorization: Bearer $LINK2AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "How do I reset my password?"},
      {"role": "assistant", "content": "You can reset your password by clicking Forgot Password on the login page."}
    ],
    "model": "gpt-4o-mini"
  }'

7. Use the proxy instead (optional)

If you use the OpenAI Python SDK, switching to proxy mode requires two lines:

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.link2.ai/openai",      # (1) point at the Controller
    api_key=os.environ["OPENAI_API_KEY"],
    default_headers={"LINK2AI_API_KEY": os.environ["LINK2AI_API_KEY"]},  # (2) add key
)

response = client.chat.completions.create(
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "How do I reset my password?"},
    ],
    model="gpt-4o-mini",
)

# Normal OpenAI response, plus analysis
print(response.choices[0].message.content)
print("Secure:", response.input_analysis["secure"], response.output_analysis["secure"])

The proxy handles both analyzeInput and analyzeOutput automatically around the LLM call.


8. Run a red team test

Proactively probe your application with adversarial attacks before shipping.

  1. Open Red Teaming → Configurations and create a configuration. Select the Application you defined in step 3 as the target, then choose the attack plugins and strategies to include.
  2. Click Generate Dataset to produce the adversarial test cases.
  3. Select the completed dataset and click Start Run. Each run tests your application both with and without guardrails so you can measure how many attacks your configuration blocks.

See Red Teaming for the full workflow.


Next steps