AI: Code 20 credits LLM

Code Generate API

Generate working code from natural language descriptions via REST API using Claude. Describe what you want the code to do, specify the programming language, and receive production-ready code with comments explaining the implementation.

Try it live →

How it works

POST a description of the code you need and a target language (JavaScript, Python, Go, Rust, SQL, etc.). Optionally specify framework constraints or style requirements. Returns the generated code and an explanation of how it works.

Use cases

API Reference

POST https://slopshop.gg/v1/llm-code-generate
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Input parameters

ParameterTypeRequiredDescription
text string required The text to process with AI
options object optional Optional configuration (format, length, etc.)

Example response

{
  "data": {
    "result": "AI-generated result based on your input.",
    "model": "claude-3-5-sonnet",
    "tokens_used": 150
  },
  "meta": {
    "credits_used": 20,
    "engine": "real",
    "ms": 4
  }
}

Examples

Three real-world scenarios showing how developers use Code Generate in production.

Example 1
Generate a CRUD handler
Generate an Express.js route handler for a REST resource.
curl -X POST https://slopshop.gg/v1/llm-code-generate \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description": "Express POST /users route that validates email and password, hashes the password with bcrypt, and inserts into a PostgreSQL users table", "language": "javascript"}'
Example 2
Generate a Python data transform
Create a function to normalize a nested JSON structure.
curl -X POST https://slopshop.gg/v1/llm-code-generate \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description": "Python function that takes a list of user dicts with nested address objects and flattens them to a CSV-compatible format", "language": "python"}'
Example 3
Generate a SQL migration
Write a migration to add a new table with indexes.
curl -X POST https://slopshop.gg/v1/llm-code-generate \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description": "PostgreSQL migration to create a marketplace_submissions table with slug, name, credits, status, and created_at columns, with a unique index on slug", "language": "sql"}'

Code examples

curl

curl -X POST https://slopshop.gg/v1/llm-code-generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "your data here"}'

Python

import requests

response = requests.post(
    "https://slopshop.gg/v1/llm-code-generate",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"input": "your data here"}
)
result = response.json()
print(result["data"])

Node.js

const response = await fetch("https://slopshop.gg/v1/llm-code-generate", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ input: "your data here" })
});
const { data } = await response.json();
console.log(data);

CLI

# Install the Slopshop CLI
npm install -g slopshop

# Set your API key
export SLOPSHOP_KEY=your_api_key

# Call llm-code-generate
slop llm-code-generate '{"input": "your data here"}'

Pricing

Credits per call
20
credits
Cost per call
$0.02
at Starter tier
Tier
LLM
Requires LLM key

Credits are purchased in bundles starting at $1 for 1,000 credits. All compute APIs like this one use 20 credits per call — that's $0.02. See all pricing tiers.

Related APIs in AI: Code

View the full API catalog · Try in playground · Documentation