Last updated: 2026-04-20

JetBrains Setup

Set up IntelliJ IDEA, WebStorm, PyCharm, and other JetBrains IDEs for SpendLil.

This guide covers WebStorm, IntelliJ IDEA, PyCharm, GoLand, and Rider. JetBrains IDEs have a built-in HTTP Client that makes testing SpendLil proxy calls straightforward.

Environment Variables

json http-client.env.json
{
  "dev": {
    "spendlil_key": "sl_abc123def456",
    "openai_key": "sk-...",
    "anthropic_key": "sk-ant-...",
    "google_key": "AIza..."
  },
  "staging": {
    "spendlil_key": "sl_staging_key",
    "openai_key": "sk-...",
    "anthropic_key": "sk-ant-..."
  }
}
Keep secrets out of version control

Commit http-client.env.json with placeholder values only. Create http-client.private.env.json (gitignored) for real keys.

HTTP Client Requests

text spendlil-api.http
### OpenAI via SpendLil
POST https://openai.gateway.spendlil.ai/v1/chat/completions
Authorization: Bearer {{openai_key}}
X-SpendLil-Key: {{spendlil_key}}
Content-Type: application/json

{
  "model": "gpt-4o-mini",
  "messages": [
    {"role": "user", "content": "Hello from JetBrains"}
  ]
}

> {%
  client.test("SpendLil governed", function() {
    client.assert(
      response.headers.valueOf("X-SpendLil-Route") === "governed",
      "Expected X-SpendLil-Route: governed"
    );
  });
%}

### Anthropic via SpendLil
POST https://anthropic.gateway.spendlil.ai/v1/messages
x-api-key: {{anthropic_key}}
anthropic-version: 2023-06-01
X-SpendLil-Key: {{spendlil_key}}
Content-Type: application/json

{
  "model": "claude-sonnet-4-5",
  "max_tokens": 256,
  "messages": [
    {"role": "user", "content": "Hello from JetBrains"}
  ]
}

> {%
  client.test("SpendLil governed", function() {
    client.assert(
      response.headers.valueOf("X-SpendLil-Route") === "governed",
      "Expected X-SpendLil-Route: governed"
    );
  });
%}

### Health Check
GET https://openai.gateway.spendlil.ai/health

> {%
  client.test("Proxy healthy", function() {
    client.assert(response.status === 200);
  });
%}

Run Configuration

  1. Run → Edit Configurations
  2. Select your configuration (or create one)
  3. In 'Environment variables', add: SPENDLIL_KEY=sl_abc123
  4. Alternatively, install the EnvFile plugin to load from .env

Live Templates

javascript Live template: slioai (JavaScript/TypeScript)
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: 'https://openai.gateway.spendlil.ai/v1',
  defaultHeaders: { 'X-SpendLil-Key': process.env.SPENDLIL_KEY },
});

const response = await client.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Hello' }],
});