Skip to main content

HackSmith Python SDK

Official Python SDK for the HackSmith AI API.

Access every model — GPT, Gemini, DeepSeek, Grok, Claude, Mistral, and more — plus AI image generation, from a single clean library. No juggling raw HTTP requests. No exposing your full codebase.


Installation

pip install hacksmith

Authentication

Every request requires an API token from your HackSmith dashboard. Tokens begin with thenoob-.


Quickstart

All-in-one client

from hacksmith import HackSmithClient

client = HackSmithClient("thenoob-your-key-here")

# Chat
reply = client.chat("Explain what a transformer model is.")
print(reply.text)

# Generate an image
job = client.generate_image("A futuristic city at dusk, cinematic lighting")
urls = job.wait()
print(urls[0])

# Generate a logo
job = client.generate_logo("A wolf head esports mascot", style="3D Logo")
urls = job.wait()
print(urls[0])

# List all available models
client.models().display()

Chat Only

from hacksmith.chat import ChatClient

client = ChatClient("thenoob-your-key")

reply = client.send("What is the capital of Ghana?")
print(reply.text)
print(reply.provider)    # e.g. "Starnest"
print(reply.model_label) # e.g. "GPT-4o"

# Choose a specific model
reply = client.send("Write a haiku about rain.", model="gemini_3_pro")
print(reply.text)

# Attach a file
reply = client.send("Summarise this document.", file_path="report.pdf")
print(reply.text)

Image Generation Only

from hacksmith.image import ImageClient

client = ImageClient("thenoob-your-key")

# General image
job = client.generate("A cyberpunk cat on a neon-lit rooftop")
urls = job.wait()

# Nano style (faster, lighter)
job = client.generate("Abstract geometric mountains", style="Nano Banana")
urls = job.wait()

# Logo
job = client.logo("A minimalist coffee shop brand", style="Elegant Logo")
urls = job.wait()

# Remix (image-to-image)
job = client.generate(
    prompt="Turn this into a watercolour painting",
    seed_image_path="photo.jpg"
)
urls = job.wait()

# See all available logo styles
print(ImageClient.logo_styles())

Available Models

from hacksmith import HackSmithClient

client = HackSmithClient("thenoob-your-key")
client.models().display()

This prints a formatted table of every available model slug and label.

Model groups include: GPT, Gemini, DeepSeek, Grok, Claude, Mistral, o-series, Perplexity.


Multiple API Keys

You can register multiple keys in one client and route requests to the right key by alias.

from hacksmith import HackSmithClient

client = HackSmithClient("thenoob-primary-key")

client.add_key("thenoob-second-key", alias="project-b")
client.add_key("thenoob-third-key",  alias="analytics")

# Use a specific key
reply = client.chat("Hello", key="project-b")

# Remove a key when done
client.remove_key("analytics")

# See all registered keys
print(client.list_keys())

System Prompts

You can set a custom system prompt per client, per key, or per message.

Disclaimer: A system prompt set here is fully isolated to your code. It does NOT read from or write to the global workspace persona configured in the HackSmith dashboard. If you do not provide a system prompt, the server automatically applies your workspace persona.

# Client-level: applied to every request from this client
client = HackSmithClient(
    "thenoob-your-key",
    system_prompt="You are a senior Python engineer. Be concise and precise."
)

# Key-level: per registered key
client.add_key(
    "thenoob-second-key",
    alias="analyst",
    system_prompt="You are a financial data analyst. Use clear bullet points."
)

# Per-request override (stacks on top of client/key-level prompt)
reply = client.chat(
    "Explain compound interest.",
    key="analyst",
    system_prompt="Limit your answer to three sentences."
)

# Update a key's system prompt at any time
client.set_system_prompt("You are a helpful assistant.", key="analyst")

# Clear the system prompt (falls back to workspace persona)
client.set_system_prompt(None, key="analyst")

Error Handling

from hacksmith import HackSmithClient
from hacksmith.exceptions import (
    AuthenticationError,
    TokenExpiredError,
    TokenRevokedError,
    RateLimitError,
    NSFWError,
    APIError,
)

client = HackSmithClient("thenoob-your-key")

try:
    reply = client.chat("Hello!")
    print(reply.text)

except TokenExpiredError:
    print("Your token has expired. Log in to HackSmith to check your plan.")

except TokenRevokedError:
    print("Token was revoked. Generate a new one from the dashboard.")

except AuthenticationError as e:
    print(f"Auth error: {e}")

except RateLimitError as e:
    print(f"Rate limit hit. Try again after: {e.reset_at}")

except NSFWError:
    print("Prompt rejected for containing disallowed content.")

except APIError as e:
    print(f"API error ({e.status_code}): {e}")

Image Job Status

If you need non-blocking image polling:

job = client.generate_image("A mountain landscape at sunrise")

# Non-blocking: check status manually
status = client.image.status(job.record_id)
print(status["status"])  # "QUEUED", "DONE", or "FAILED"

# Blocking: wait until done (default: polls every 3s, max 180s)
urls = job.wait(poll_interval=3.0, max_wait=180.0)

Logo Styles

from hacksmith.image import ImageClient
print(ImageClient.logo_styles())

Available: Minimalistic Logo, Monogram Logo, Futuristic Logo, Elegant Logo, Gradient Logo, 3D Logo, Epic Logo, Combination Logo, Emblem Logo, Abstract Logo, Mascots Logo, Geometric Logo, Hand-drawn Logo, Grunge Logo — plus numbered variants for each.


License

MIT — Copyright codeleabwithosman

Metadata

Release files for hacksmith 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hacksmith 1.0.0
File Size Uploaded Provenance
hacksmith-1.0.0.tar.gz 14.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hacksmith 1.0.0
File Interpreter ABI Platform
hacksmith-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.6 kB

Release files / hacksmith-1.0.0.tar.gz

Download URL hacksmith-1.0.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
509cce082a3f36be7c3fe8a0ca6256c570693a927592e28d5ad44f394f444b87
BLAKE2b-256 checksum
How to use checksums
aeb6245e0b535c3f218409677333b4cd488162dc426159f6a1a655cce7b639d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / hacksmith-1.0.0-py3-none-any.whl

Download URL hacksmith-1.0.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a830eaba937c83fbacdc0f7714c377f2cd018d4bd24c70cc881f0d71600d93cd
BLAKE2b-256 checksum
How to use checksums
188c2c8525f15217317e5d36b2d2810f723e2b24ec4bb54c953ba10f4797c7cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for hacksmith 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page