SolonGate Logo
  • Docs
  • Pricing
Sign inBook a Demo

Loading...

IntroductionPrerequisitesQuick StartAPI KeysInstallationPoliciesPrompt Inj. DetectionAI JudgeAgent Trust MapOpenClawDashboard Guide
GitHub

# API Keys

SolonGate uses API keys for authentication. Each project gets both live and test keys.

Livesg_live_xxx

Production keys. Connects to api.solongate.com for policy sync, audit logging, and dashboard integration.

Testsg_test_xxx

Development keys. Works offline — no API connection needed. Uses local policy.json only.

How to Get Your API Keys

1

Create an account

Go to auth.solongate.com and sign up with email, GitHub, or Google.

2

Create a project

In the dashboard, go to Projects → Create Project. Enter a name and description.

3

Copy your keys

After creation, both sg_live_ and sg_test_ keys are shown once. Copy and save them immediately.

Setting Up Your API Key

The recommended way is to put your key in a .env file in your project root:

bash
1# .env
2# Get your keys from: https://solongate.com → Dashboard → Projects
3# IMPORTANT: Never commit this file to git!
4
5# Live key — connects to dashboard for policy sync + audit logging
6SOLONGATE_API_KEY=sg_live_your_key_here
7
8# Test key — offline mode, no dashboard connection (for development)
9# SOLONGATE_API_KEY=sg_test_your_key_here

Security Rules

  • Never commit .env to git — add it to .gitignore
  • Never hardcode keys in source code — always use environment variables
  • If a key is leaked, go to Dashboard → API Keys → Roll (rotate) immediately
  • Use sg_test_ keys for development — they work offline without API validation

If you use npx @solongate/proxy@latest init, a .env file is created automatically with placeholder keys.

Authentication Methods

bash
1curl -X POST https://api.solongate.com/api/v1/validate \
2 -H "X-API-Key: sg_live_xxxxxxxxxxxxxxxxxxxx" \
3 -H "Content-Type: application/json" \
4 -d '{"tool": "file_read", "arguments": {"path": "/data/file.txt"}}'

Using API Keys in Code

typescript
1import { SolonGate } from '@solongate/proxy';
2
3// From environment variable (recommended)
4const gate = new SolonGate({
5 name: 'my-app',
6 apiKey: process.env.SOLONGATE_API_KEY!,
7});
8
9// Validate a tool call
10const result = await gate.executeToolCall(
11 { name: 'file_read', arguments: { path: '/data/doc.txt' } },
12 async (params) => upstreamServer.callTool(params),
13);

Live vs Test Keys

Featuresg_live_sg_test_
Policy evaluationFrom dashboard (cloud)Local policy.json only
Audit loggingSent to dashboardLocal only
Input guardActiveActive
Rate limitingActiveActive
Online validationRequired (checks api.solongate.com)Not needed (works offline)
Use caseProduction, stagingDevelopment, CI/CD, unit tests
Quick StartInstallation