Complete, copy-paste examples that work with the demo key. From research agents to data pipelines, every pattern you need to build with 82 categories of tools.
The real power of Slopshop is not individual tools -- it is what you build by combining them. These 6 combos show multi-feature workflows you can copy-paste and run today.
Chain Claude, Grok, and Claude in an infinite loop with free memory storage. The agent researches, critiques itself, and improves -- on autopilot overnight.
# 1. Create the infinite research chain
curl -X POST https://slopshop.gg/v1/chain/create \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"name":"research-loop","loop":true,"steps":[
{"agent":"claude","prompt":"Research latest AI infrastructure trends","pass_context":true},
{"agent":"grok","prompt":"Critique the research, find gaps and contradictions","pass_context":true},
{"agent":"claude","prompt":"Improve the research based on critique, find new angles","pass_context":true}
]}'
# 2. Queue it for overnight execution
curl -X POST https://slopshop.gg/v1/chain/queue \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"frequency":"daily"}'
# 3. Results auto-stored in free memory
curl -X POST https://slopshop.gg/v1/memory-get \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"key":"chain_results"}'Create a full product team with workspace, roles, daily standups, knowledge sharing, and democratic decision-making across 5 agents.
# 1. Create workspace
curl -X POST https://slopshop.gg/v1/hive/create \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"name":"product-team","channels":["research","writing","review"]}'
# 2. Assign agents with roles
curl -X POST https://slopshop.gg/v1/copilot/scale \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"main_session_id":"product-team","count":5,"roles":["researcher","writer","critic","editor","publisher"]}'
# 3. Daily standups
curl -X POST https://slopshop.gg/v1/standup/submit \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"yesterday":"Wrote 3 articles","today":"Review and publish"}'
# 4. Knowledge sharing between agents
curl -X POST https://slopshop.gg/v1/knowledge/add \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"subject":"article-1","predicate":"reviewed_by","object":"critic-agent"}'
# 5. Democratic decisions
curl -X POST https://slopshop.gg/v1/governance/propose \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"title":"Should we pivot topics?"}'Route to the cheapest LLM, deploy a massive army of 1,000 agents, save the replay for auditing, and verify results with Merkle proofs.
# 1. Choose best LLM for the task
curl -X POST https://slopshop.gg/v1/router/smart \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"task":"analyze financial data","optimize_for":"cost"}'
# 2. Deploy 1,000 parallel agents
curl -X POST https://slopshop.gg/v1/army/deploy \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"task":"analyze","count":10000,"api":"text-word-count"}'
# 3. Save replay for auditing
curl -X POST https://slopshop.gg/v1/replay/save \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"name":"big-analysis","events":[...]}'
# 4. Verify results with Merkle proof
curl -X POST https://slopshop.gg/v1/proof/merkle \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"data":"...results..."}'Run evals, store lessons in persistent memory, compete in tournaments against other versions, and loop to auto-improve over time.
# 1. Run baseline eval
curl -X POST https://slopshop.gg/v1/eval/run \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"agent_slug":"text-word-count","test_cases":[{"input":{"text":"hello world"},"expected":{"word_count":2}}]}'
# 2. Store lessons in free memory
curl -X POST https://slopshop.gg/v1/memory-set \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"key":"eval_lessons","value":"accuracy was 95%"}'
# 3. Compete in tournament
curl -X POST https://slopshop.gg/v1/tournament/create \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"name":"best-analyzer","participants":["agent-v1","agent-v2"]}'
# 4. Auto-improve: chain loops eval -> learn -> re-evalRun a research workflow that stores findings in persistent memory, then retrieve and search them across sessions.
# 1. Run research
curl -X POST https://slopshop.gg/v1/research \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"query":"Compare agent platforms 2026","tier":"standard","namespace":"my-research"}'
# 2. Store findings in memory
curl -X POST https://slopshop.gg/v1/memory-set \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"namespace":"my-research","key":"findings-v1","value":"Slopshop leads in tool count and memory","tags":"research,agents"}'
# 3. Search memory later
curl -X POST https://slopshop.gg/v1/memory-search \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"namespace":"my-research","query":"agent platforms"}'
# 4. Check credits used
curl https://slopshop.gg/v1/credits/balance \
-H "Authorization: Bearer $KEY"Set up teams with budgets, monitor usage in real time, forecast costs, and get Slack alerts when budgets run low.
# 1. Create team
curl -X POST https://slopshop.gg/v1/teams/create \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"name":"Engineering"}'
# 2. Set monthly budget
curl -X POST https://slopshop.gg/v1/keys/set-budget \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"monthly_budget":50000}'
# 3. Monitor usage
curl -s https://slopshop.gg/v1/analytics/usage \
-H "Authorization: Bearer $KEY"
# 4. Forecast costs
curl -s https://slopshop.gg/v1/analytics/cost-forecast \
-H "Authorization: Bearer $KEY"
# 5. Set Slack alerts for budget warnings
curl -X POST https://slopshop.gg/v1/webhooks/create \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"url":"https://slack.com/webhook","events":["budget_alert"]}'Build an agent that searches for information, summarizes findings, and stores them in persistent memory for future sessions. Uses agent mode for auto-suggestions and memory persistence.
# Step 1: Search and store the query in memory curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "research-agent", "key": "query-1", "value": "Investigating AI agent frameworks in 2026", "tags": "research,ai,agents" }' # Step 2: Summarize gathered text curl -X POST https://slopshop.gg/v1/text-word-count \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"text": "AI agent frameworks have evolved significantly. LangChain, CrewAI, and AutoGen lead the market. Slopshop provides the infrastructure layer with 1250 APIs."}' # Step 3: Store findings with agent mode for suggestions curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "research-agent", "key": "finding-1", "value": "{\"topic\":\"AI frameworks\",\"leaders\":[\"LangChain\",\"CrewAI\",\"AutoGen\"],\"infra\":\"Slopshop\"}", "tags": "finding,ai,frameworks", "mode": "agent" }'
const API = 'https://slopshop.gg/v1'; const KEY = 'sk-slop-demo-key-12345678'; const headers = { 'Authorization': `Bearer ${KEY}`, 'Content-Type': 'application/json' }; // Store research query await fetch(`${API}/memory-set`, { method: 'POST', headers, body: JSON.stringify({ namespace: 'research-agent', key: 'query-1', value: 'Investigating AI agent frameworks in 2026', tags: 'research,ai,agents', }), }); // Retrieve findings later const findings = await fetch(`${API}/memory-get`, { method: 'POST', headers, body: JSON.stringify({ namespace: 'research-agent', key: 'finding-1' }), }).then(r => r.json()); console.log('Stored finding:', findings.data);
Create a workspace where multiple agents review code simultaneously. One agent counts lines, another checks for patterns, and a third analyzes complexity. Results are batched for efficiency.
curl -X POST https://slopshop.gg/v1/batch \
-H "Authorization: Bearer sk-slop-demo-key-12345678" \
-H "Content-Type: application/json" \
-d '{
"calls": [
{
"slug": "text-word-count",
"input": { "text": "function add(a, b) { return a + b; }" }
},
{
"slug": "hash-sha256",
"input": { "input": "function add(a, b) { return a + b; }" }
},
{
"slug": "text-reverse",
"input": { "text": "function add(a, b) { return a + b; }" }
}
]
}'
const code = 'function add(a, b) { return a + b; }'; // Run all review agents in parallel via batch const review = await fetch('https://slopshop.gg/v1/batch', { method: 'POST', headers: { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }, body: JSON.stringify({ calls: [ { slug: 'text-word-count', input: { text: code } }, { slug: 'hash-sha256', input: { input: code } }, { slug: 'text-character-count', input: { text: code } }, ], }), }).then(r => r.json()); console.log('Word count:', review.results[0].data); console.log('Code hash:', review.results[1].data); console.log('Char count:', review.results[2].data); console.log(`Total cost: ${review.total_credits} credits`);
Store and retrieve agent state across sessions using namespaced memory. Free tier includes persistent SQLite-backed storage with tagging and search support.
# Store a value in persistent memory curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "my-agent", "key": "user-preferences", "value": "{\"theme\":\"dark\",\"language\":\"en\",\"timezone\":\"UTC\"}", "tags": "preferences,user-config" }' # Retrieve it later (even after server restart) curl -X POST https://slopshop.gg/v1/memory-get \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"namespace": "my-agent", "key": "user-preferences"}' # List all keys in a namespace curl -X POST https://slopshop.gg/v1/memory-list \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"namespace": "my-agent"}' # Search by tags curl -X POST https://slopshop.gg/v1/memory-search \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"namespace": "my-agent", "tag": "preferences"}'
import requests, json API = "https://slopshop.gg/v1" HEADERS = {"Authorization": "Bearer sk-slop-demo-key-12345678"} # Store session state requests.post(f"{API}/memory-set", headers=HEADERS, json={ "namespace": "my-agent", "key": "conversation-history", "value": json.dumps([ {"role": "user", "content": "Hello"}, {"role": "assistant", "content": "Hi there!"}, ]), "tags": "conversation,session-1", }) # Retrieve in a new session resp = requests.post(f"{API}/memory-get", headers=HEADERS, json={ "namespace": "my-agent", "key": "conversation-history", }) history = json.loads(resp.json()["data"]["value"]) print(f"Resumed session with {len(history)} messages")
Validate email addresses, phone numbers, and credit card numbers in a single batch call before processing user registrations. All validators run in parallel.
curl -X POST https://slopshop.gg/v1/batch \
-H "Authorization: Bearer sk-slop-demo-key-12345678" \
-H "Content-Type: application/json" \
-d '{
"calls": [
{ "slug": "validate-email", "input": { "email": "user@example.com" } },
{ "slug": "validate-phone", "input": { "phone": "+1-555-123-4567" } },
{ "slug": "validate-credit-card", "input": { "number": "4111111111111111" } }
]
}'
async function validateUserInput(email, phone, card) { const res = await fetch('https://slopshop.gg/v1/batch', { method: 'POST', headers: { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }, body: JSON.stringify({ calls: [ { slug: 'validate-email', input: { email } }, { slug: 'validate-phone', input: { phone } }, { slug: 'validate-credit-card', input: { number: card } }, ], }), }).then(r => r.json()); const [emailResult, phoneResult, cardResult] = res.results; return { emailValid: emailResult.data?.valid, phoneValid: phoneResult.data?.valid, cardValid: cardResult.data?.valid, cost: res.total_credits, }; } const validation = await validateUserInput( 'user@example.com', '+1-555-123-4567', '4111111111111111' ); console.log(validation);
Generate SHA-256 hashes for data integrity verification. Hash files, API responses, or any text to create a tamper-proof record of content.
# Generate a SHA-256 hash curl -X POST https://slopshop.gg/v1/hash-sha256 \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"input": "important contract text that must not be altered"}' # Verify by hashing the same input again and comparing curl -X POST https://slopshop.gg/v1/hash-sha256 \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"input": "important contract text that must not be altered"}' # Both return the same hash - data integrity verified
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; // Hash original data const original = 'important contract text'; const hash1 = await fetch('https://slopshop.gg/v1/hash-sha256', { method: 'POST', headers, body: JSON.stringify({ input: original }), }).then(r => r.json()); // Later: verify data has not been tampered with const received = 'important contract text'; const hash2 = await fetch('https://slopshop.gg/v1/hash-sha256', { method: 'POST', headers, body: JSON.stringify({ input: received }), }).then(r => r.json()); const verified = hash1.data.hash === hash2.data.hash; console.log(`Integrity check: ${verified ? 'PASSED' : 'FAILED'}`);
Index your codebase into a knowledge graph using memory namespaces. Store file hashes, dependencies, and function signatures for instant agent lookup across sessions.
# Store a file node in the knowledge graph curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "codebase-graph", "key": "src/server.js", "value": "{\"type\":\"file\",\"functions\":[\"handleRequest\",\"authenticate\"],\"imports\":[\"express\",\"cors\"],\"lines\":450}", "tags": "file,javascript,server" }' # Store a dependency edge curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "codebase-graph", "key": "edge:server-to-auth", "value": "{\"from\":\"src/server.js\",\"to\":\"src/auth.js\",\"type\":\"imports\"}", "tags": "edge,dependency" }' # Query: find all files tagged as JavaScript curl -X POST https://slopshop.gg/v1/memory-search \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"namespace": "codebase-graph", "tag": "javascript"}'
const API = 'https://slopshop.gg/v1'; const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; async function indexFile(path, metadata) { // Hash the file content for change detection const hash = await fetch(`${API}/hash-sha256`, { method: 'POST', headers, body: JSON.stringify({ input: metadata.content }), }).then(r => r.json()); // Store in knowledge graph await fetch(`${API}/memory-set`, { method: 'POST', headers, body: JSON.stringify({ namespace: 'codebase-graph', key: path, value: JSON.stringify({ ...metadata, hash: hash.data.hash }), tags: `file,${metadata.language}`, }), }); } await indexFile('src/server.js', { language: 'javascript', functions: ['handleRequest', 'authenticate'], imports: ['express', 'cors'], content: '// file content here...', });
Implement A/B testing by using random number generation for assignment, UUID generation for tracking, and memory for storing results. Analyze outcomes with the stats API.
# Generate a random assignment (0 or 1) curl -X POST https://slopshop.gg/v1/random-number \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"min": 0, "max": 1}' # Generate a tracking UUID for this user curl -X POST https://slopshop.gg/v1/uuid-generate \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{}' # Store the experiment result curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "ab-test-checkout-v2", "key": "user-550e8400", "value": "{\"variant\":\"B\",\"converted\":true,\"revenue\":49.99}", "tags": "variant-b,converted" }'
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; async function assignVariant(userId) { // Deterministic assignment via hashing the user ID const hash = await fetch('https://slopshop.gg/v1/hash-sha256', { method: 'POST', headers, body: JSON.stringify({ input: userId + ':checkout-v2' }), }).then(r => r.json()); // Use last hex char for assignment (even = A, odd = B) const lastChar = parseInt(hash.data.hash.slice(-1), 16); return lastChar % 2 === 0 ? 'A' : 'B'; } const variant = await assignVariant('user-123'); console.log(`Assigned to variant: ${variant}`); // Same user always gets the same variant (deterministic)
Store structured data in persistent memory and retrieve it across agent sessions. Use namespaces and tags to organize knowledge that survives restarts.
# Store project context curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "project-alpha", "key": "architecture", "value": "{\"stack\":\"React + Node\",\"database\":\"SQLite\",\"deploy\":\"Railway\"}", "tags": "architecture,decisions" }' # Store a decision log entry curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "project-alpha", "key": "decision-001", "value": "{\"decision\":\"Use SQLite over Postgres\",\"reason\":\"Zero-config, self-hostable\",\"date\":\"2026-03-30\"}", "tags": "decision,database" }' # Search memory by query curl -X POST https://slopshop.gg/v1/memory-search \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"namespace": "project-alpha", "query": "database"}'
import requests, json API = "https://slopshop.gg/v1" HEADERS = {"Authorization": "Bearer sk-slop-demo-key-12345678"} # Store context for multiple agents for key, value in [ ("stack", {"frontend": "React", "backend": "Node"}), ("goals", {"q2": "Launch v3", "q3": "10k users"}), ]: requests.post(f"{API}/memory-set", headers=HEADERS, json={ "namespace": "project-alpha", "key": key, "value": json.dumps(value), "tags": "project,context", }) # Retrieve later (even from a different session) result = requests.post(f"{API}/memory-get", headers=HEADERS, json={ "namespace": "project-alpha", "key": "stack", }) print(result.json())
Chain multiple tools together: validate input, hash it for integrity, store results in memory, and retrieve them later. A practical pipeline pattern.
# Step 1: Validate input data curl -X POST https://slopshop.gg/v1/validate-email \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"email": "user@example.com"}' # Step 2: Hash the validated data for integrity curl -X POST https://slopshop.gg/v1/crypto-hash-sha256 \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"data": "user@example.com"}' # Step 3: Store processing result in memory curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "pipeline-results", "key": "run-001", "value": "{\"input\":\"user@example.com\",\"valid\":true,\"hash\":\"abc123...\",\"processed_at\":\"2026-03-30\"}", "tags": "pipeline,validation,complete" }'
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; const post = (slug, body) => fetch(`https://slopshop.gg/v1/${slug}`, { method: 'POST', headers, body: JSON.stringify(body), }).then(r => r.json()); // Validate, hash, and store in one pipeline const email = 'user@example.com'; const validation = await post('validate-email', { email }); const hash = await post('crypto-hash-sha256', { data: email }); await post('memory-set', { namespace: 'pipeline-results', key: 'run-001', value: JSON.stringify({ email, valid: validation.data, hash: hash.data }), tags: 'pipeline,complete', }); console.log('Pipeline complete, results stored in memory');
Run 100 parallel hash operations in two batch requests of 50 each. Demonstrates how to process large datasets using the batch endpoint with maximum parallelism.
# Batch 1: first 50 hash operations curl -X POST https://slopshop.gg/v1/batch \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "calls": [ { "slug": "hash-sha256", "input": { "input": "document-001" } }, { "slug": "hash-sha256", "input": { "input": "document-002" } }, { "slug": "hash-sha256", "input": { "input": "document-003" } } ] }' # (Repeat with up to 50 calls per batch request)
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; // Generate 100 documents to process const documents = Array.from({ length: 100 }, (_, i) => `document-${String(i).padStart(3, '0')}`); // Split into batches of 50 (max per request) const chunks = []; for (let i = 0; i < documents.length; i += 50) { chunks.push(documents.slice(i, i + 50)); } // Execute all batches in parallel const batchResults = await Promise.all( chunks.map(chunk => fetch('https://slopshop.gg/v1/batch', { method: 'POST', headers, body: JSON.stringify({ calls: chunk.map(doc => ({ slug: 'hash-sha256', input: { input: doc }, })), }), }).then(r => r.json()) ) ); const allResults = batchResults.flatMap(b => b.results); const totalCredits = batchResults.reduce((sum, b) => sum + b.total_credits, 0); console.log(`Processed ${allResults.length} documents for ${totalCredits} credits`);
Use Server-Sent Events to stream API results in real time. Ideal for LLM-tier tools that generate long text, or any operation where you want progress updates.
# Stream results with -N to disable buffering curl -N -X POST https://slopshop.gg/v1/stream/text-reverse \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"text": "streaming is powerful for real-time agent feedback"}' # You'll see events like: # event: start # data: {"slug":"text-reverse","credits":1,"ts":"2026-03-27T12:00:00Z"} # # event: progress # data: {"status":"executing","percent":0} # # event: result # data: {"reversed":"kcabdeef tnega emit-laer rof lufrewop si gnimaerts"} # # event: done # data: {"ok":true,"latency_ms":3}
async function streamApi(slug, input) { const res = await fetch(`https://slopshop.gg/v1/stream/${slug}`, { method: 'POST', headers: { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json', }, body: JSON.stringify(input), }); const reader = res.body.getReader(); const decoder = new TextDecoder(); let buffer = ''; while (true) { const { done, value } = await reader.read(); if (done) break; buffer += decoder.decode(value, { stream: true }); // Parse complete SSE events const events = buffer.split('\n\n'); buffer = events.pop(); // keep incomplete event for (const event of events) { const lines = event.split('\n'); let type = '', data = ''; for (const line of lines) { if (line.startsWith('event: ')) type = line.slice(7); if (line.startsWith('data: ')) data = line.slice(6); } if (data) console.log(`[${type}]`, JSON.parse(data)); } } } await streamApi('text-reverse', { text: 'streaming demo' });
Reduce HTTP overhead by combining multiple independent API calls into a single batch request. All calls execute in parallel and return together.
curl -X POST https://slopshop.gg/v1/batch \
-H "Authorization: Bearer sk-slop-demo-key-12345678" \
-H "Content-Type: application/json" \
-d '{
"calls": [
{ "slug": "uuid-generate", "input": {} },
{ "slug": "random-number", "input": { "min": 1, "max": 100 } },
{ "slug": "text-reverse", "input": { "text": "efficiency" } },
{ "slug": "hash-sha256", "input": { "input": "batch-test" } },
{ "slug": "text-word-count", "input": { "text": "how many words are in this sentence" } }
]
}'
import requests resp = requests.post( "https://slopshop.gg/v1/batch", headers={"Authorization": "Bearer sk-slop-demo-key-12345678"}, json={ "calls": [ {"slug": "uuid-generate", "input": {}}, {"slug": "random-number", "input": {"min": 1, "max": 100}}, {"slug": "text-reverse", "input": {"text": "efficiency"}}, {"slug": "hash-sha256", "input": {"input": "batch-test"}}, {"slug": "text-word-count", "input": {"text": "count these words"}}, ] }, ) data = resp.json() print(f"5 APIs called in 1 request: {data['total_credits']} credits, {data['total_latency_ms']}ms") for r in data["results"]: print(f" {r['slug']}: {r['latency_ms']}ms")
Leverage agent mode with trace enabled for pair programming. The API returns suggestions for next steps and persists the session state, so your coding assistant always has context.
# Agent mode + trace for full visibility curl -X POST https://slopshop.gg/v1/text-word-count \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "text": "function fibonacci(n) { if (n <= 1) return n; return fibonacci(n-1) + fibonacci(n-2); }", "mode": "agent", "trace": true, "session_id": "pair-programming-session" }' # Response includes: # - data: word count result # - agent.suggestions: ["text-character-count", "hash-sha256", ...] # - agent.memory_persisted: { namespace, key } # - trace: [{ step: "received" }, { step: "credits_checked" }, ...]
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; const SESSION = 'pair-programming-session'; async function copilotCall(slug, input) { const res = await fetch(`https://slopshop.gg/v1/${slug}`, { method: 'POST', headers, body: JSON.stringify({ ...input, mode: 'agent', trace: true, session_id: SESSION, }), }).then(r => r.json()); console.log('Result:', res.data); console.log('Suggestions:', res.agent?.suggestions); console.log('Trace:', res.trace); return res; } // Analyze code during pair programming const result = await copilotCall('text-word-count', { text: 'function fibonacci(n) { return n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2); }', }); // Follow a suggestion if (result.agent?.suggestions?.length) { console.log(`Next: try ${result.agent.suggestions[0]}`); }
Create teams, invite members, generate scoped API keys, and set custom rate limits. Enterprise features provide full control over who can access which APIs and how much they can spend.
# Create a team curl -X POST https://slopshop.gg/v1/enterprise/teams \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"name": "Engineering Team"}' # Add a team member curl -X POST https://slopshop.gg/v1/enterprise/teams/TEAM_ID/members \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"email": "dev@company.com", "role": "member"}' # Generate a scoped team key curl -X POST https://slopshop.gg/v1/enterprise/keys \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"team_id": "TEAM_ID", "name": "CI/CD Key", "scopes": ["compute"]}' # Set custom rate limits for the team curl -X POST https://slopshop.gg/v1/enterprise/rate-limits \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"team_id": "TEAM_ID", "requests_per_minute": 200}'
const API = 'https://slopshop.gg/v1'; const headers = { 'Authorization': 'Bearer sk-slop-your-admin-key', 'Content-Type': 'application/json' }; // Create a team const team = await fetch(`${API}/enterprise/teams`, { method: 'POST', headers, body: JSON.stringify({ name: 'Engineering Team' }), }).then(r => r.json()); console.log('Team created:', team.data.id); // Generate a scoped key for CI/CD const key = await fetch(`${API}/enterprise/keys`, { method: 'POST', headers, body: JSON.stringify({ team_id: team.data.id, name: 'CI/CD Pipeline', scopes: ['compute'], }), }).then(r => r.json()); console.log('Scoped key:', key.data.key);
Monitor your API usage in real time using the SSE usage stream and credit balance endpoints. Build dashboards that track spending, popular APIs, and error rates.
# Check current balance curl https://slopshop.gg/v1/credits/balance \ -H "Authorization: Bearer sk-slop-demo-key-12345678" # Get credit history curl https://slopshop.gg/v1/credits/history \ -H "Authorization: Bearer sk-slop-demo-key-12345678" # Subscribe to real-time usage stream (SSE) curl -N https://slopshop.gg/v1/stream/usage \ -H "Authorization: Bearer sk-slop-demo-key-12345678" # Events arrive as: # data: {"key":"sk-slop-demo-","slug":"text-reverse","credits":1,"status":"ok","ts":"..."}
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678' }; // Check balance const balance = await fetch('https://slopshop.gg/v1/credits/balance', { headers }).then(r => r.json()); console.log(`Balance: ${balance.credits} credits ($${(balance.credits * 0.005).toFixed(2)})`); // Monitor usage in real time const evtSource = new EventSource('https://slopshop.gg/v1/stream/usage'); const stats = { calls: 0, credits: 0, errors: 0 }; evtSource.onmessage = (event) => { const data = JSON.parse(event.data); stats.calls++; stats.credits += data.credits || 0; if (data.status === 'error') stats.errors++; console.log(`[${data.slug}] ${data.credits} credits | Total: ${stats.credits}`); };
Parse Dockerfiles to extract base images, stages, and instructions. Validate structure and identify potential issues before deploying to production.
curl -X POST https://slopshop.gg/v1/dockerfile-parse \
-H "Authorization: Bearer sk-slop-demo-key-12345678" \
-H "Content-Type: application/json" \
-d '{
"content": "FROM node:18-alpine AS builder\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci --production\nCOPY . .\nRUN npm run build\n\nFROM node:18-alpine\nWORKDIR /app\nCOPY --from=builder /app/dist ./dist\nCOPY --from=builder /app/node_modules ./node_modules\nEXPOSE 3000\nCMD [\"node\", \"dist/server.js\"]"
}'
const dockerfile = `FROM node:18-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci --production COPY . . RUN npm run build FROM node:18-alpine WORKDIR /app COPY --from=builder /app/dist ./dist EXPOSE 3000 CMD ["node", "dist/server.js"]`; const result = await fetch('https://slopshop.gg/v1/dockerfile-parse', { method: 'POST', headers: { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }, body: JSON.stringify({ content: dockerfile }), }).then(r => r.json()); console.log('Stages:', result.data.stages); console.log('Base images:', result.data.base_images); console.log('Instructions:', result.data.instructions);
Evaluate prompt quality before sending to expensive LLMs. Score prompts on clarity, specificity, and completeness to reduce wasted tokens and improve output quality.
curl -X POST https://slopshop.gg/v1/prompt-score \
-H "Authorization: Bearer sk-slop-demo-key-12345678" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Write a Python function that takes a list of integers and returns the top 3 most frequent elements. Handle ties by preferring smaller numbers. Include type hints and a docstring."
}'
# Response includes quality score, suggestions for improvement,
# and estimated token count
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; async function scoreAndSend(prompt) { // Score the prompt first (cheap) const score = await fetch('https://slopshop.gg/v1/prompt-score', { method: 'POST', headers, body: JSON.stringify({ prompt }), }).then(r => r.json()); console.log(`Prompt quality: ${score.data.score}/100`); if (score.data.score < 60) { console.log('Prompt quality too low. Suggestions:'); console.log(score.data.suggestions); return null; } // Prompt is good enough, proceed with LLM call console.log('Prompt approved, sending to LLM...'); return score; } await scoreAndSend('Write a Python function for finding top 3 frequent elements with type hints.');
Scan text for personally identifiable information (PII) like emails, phone numbers, SSNs, and credit card numbers. Automatically redact sensitive data before logging or storing.
curl -X POST https://slopshop.gg/v1/pii-detect \
-H "Authorization: Bearer sk-slop-demo-key-12345678" \
-H "Content-Type: application/json" \
-d '{
"text": "Contact John Smith at john.smith@company.com or call 555-123-4567. His SSN is 123-45-6789 and card is 4111-1111-1111-1111."
}'
# Response identifies all PII entities with positions and types:
# - email: john.smith@company.com
# - phone: 555-123-4567
# - ssn: 123-45-6789
# - credit_card: 4111-1111-1111-1111
import requests def redact_pii(text): resp = requests.post( "https://slopshop.gg/v1/pii-detect", headers={"Authorization": "Bearer sk-slop-demo-key-12345678"}, json={"text": text}, ) data = resp.json()["data"] # Redact each detected PII entity redacted = text for entity in reversed(data.get("entities", [])): placeholder = f"[{entity['type'].upper()}_REDACTED]" redacted = redacted[:entity["start"]] + placeholder + redacted[entity["end"]:] return redacted text = "Email me at john@example.com or call 555-123-4567" print(redact_pii(text)) # "Email me at [EMAIL_REDACTED] or call [PHONE_REDACTED]"
Implement a governance system where agent actions require approval. Log all decisions with hashes for tamper-proof audit trails, and use memory to track approval workflows.
# Step 1: Agent proposes an action curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "governance", "key": "proposal-001", "value": "{\"action\":\"deploy-v3\",\"proposer\":\"agent-alpha\",\"status\":\"pending\",\"votes\":{},\"threshold\":2}", "tags": "proposal,pending,deploy" }' # Step 2: Hash the proposal for tamper-proofing curl -X POST https://slopshop.gg/v1/hash-sha256 \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{"input": "deploy-v3:agent-alpha:pending:2"}' # Step 3: Another agent votes to approve curl -X POST https://slopshop.gg/v1/memory-set \ -H "Authorization: Bearer sk-slop-demo-key-12345678" \ -H "Content-Type: application/json" \ -d '{ "namespace": "governance", "key": "vote-001-beta", "value": "{\"proposal\":\"proposal-001\",\"voter\":\"agent-beta\",\"vote\":\"approve\",\"reason\":\"Tests passed\"}", "tags": "vote,proposal-001,approve" }'
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; const post = (slug, body) => fetch(`https://slopshop.gg/v1/${slug}`, { method: 'POST', headers, body: JSON.stringify(body), }).then(r => r.json()); async function propose(action, proposer) { const id = (await post('uuid-generate', {})).data.uuid; const proposal = { action, proposer, status: 'pending', votes: {}, threshold: 2 }; // Store proposal await post('memory-set', { namespace: 'governance', key: `proposal-${id}`, value: JSON.stringify(proposal), tags: 'proposal,pending', }); // Create tamper-proof hash const hash = await post('hash-sha256', { input: JSON.stringify(proposal) }); await post('memory-set', { namespace: 'governance', key: `hash-${id}`, value: hash.data.hash, tags: 'audit-hash', }); return id; } const proposalId = await propose('deploy-v3', 'agent-alpha'); console.log(`Proposal ${proposalId} created and hash-locked`);
Calculate key business metrics in a single batch call. Combine statistics, percentages, and financial calculations to build a comprehensive business health dashboard.
curl -X POST https://slopshop.gg/v1/batch \
-H "Authorization: Bearer sk-slop-demo-key-12345678" \
-H "Content-Type: application/json" \
-d '{
"calls": [
{
"slug": "math-evaluate",
"input": { "expression": "((50000 - 10000) / 10000) * 100" }
},
{
"slug": "math-evaluate",
"input": { "expression": "49.99 * 24" }
},
{
"slug": "math-evaluate",
"input": { "expression": "(50 / 1000) * 100" }
}
]
}'
# Results:
# [0] ROI: 400% (invested $10K, returned $50K)
# [1] LTV: $1,199.76 ($49.99/mo * 24 months avg)
# [2] Churn rate: 5% (50 lost / 1000 total)
const headers = { 'Authorization': 'Bearer sk-slop-demo-key-12345678', 'Content-Type': 'application/json' }; async function businessDashboard({ revenue, investment, monthlyPrice, avgMonths, churned, totalCustomers }) { const res = await fetch('https://slopshop.gg/v1/batch', { method: 'POST', headers, body: JSON.stringify({ calls: [ { slug: 'math-evaluate', input: { expression: `((${revenue} - ${investment}) / ${investment}) * 100` } }, { slug: 'math-evaluate', input: { expression: `${monthlyPrice} * ${avgMonths}` } }, { slug: 'math-evaluate', input: { expression: `(${churned} / ${totalCustomers}) * 100` } }, ], }), }).then(r => r.json()); return { roi: `${res.results[0].data.result}%`, ltv: `$${res.results[1].data.result}`, churnRate: `${res.results[2].data.result}%`, cost: `${res.total_credits} credits`, }; } const metrics = await businessDashboard({ revenue: 50000, investment: 10000, monthlyPrice: 49.99, avgMonths: 24, churned: 50, totalCustomers: 1000, }); console.log('ROI:', metrics.roi); // 400% console.log('LTV:', metrics.ltv); // $1199.76 console.log('Churn rate:', metrics.churnRate); // 5%