Last updated: 2026-04-12
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
X-SpendLil-Key: {{spendlil_key}}
X-Provider-Key: Bearer {{openai_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-SpendLil-Key: {{spendlil_key}}
X-Provider-Key: Bearer {{anthropic_key}}
Content-Type: application/json
anthropic-version: 2023-06-01
{
"model": "claude-sonnet-4-5-20250514",
"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
- Run → Edit Configurations
- Select your configuration (or create one)
- In 'Environment variables', add: SPENDLIL_KEY=sl_abc123
- Alternatively, install the EnvFile plugin to load from .env
Live Templates
javascript Live template: slioai (JavaScript/TypeScript)
const response = await fetch(
'https://openai.gateway.spendlil.ai/v1/chat/completions',
{
method: 'POST',
headers: {
'X-SpendLil-Key': process.env.SPENDLIL_KEY,
'X-Provider-Key': `Bearer ${process.env.OPENAI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: '$MODEL$',
messages: [{ role: 'user', content: '$PROMPT$' }],
}),
}
);