Echostash SDK for Python
The universal prompt SDK. Fetch prompts from any PLP-compliant library and use them with any AI provider.
Installation
pip install echostash
Quick Start
from echostash import Echostash
from openai import OpenAI
# Connect to any PLP-compliant server
es = Echostash("https://api.echostash.com", api_key="sk_...")
# Fetch a prompt and use with OpenAI
prompt = es.prompt("welcome-email").get()
message = prompt.with_vars(name="Alice").openai()
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[message]
)
The Fluent API
The SDK is designed to be intuitive and chainable:
# Fetch + substitute + convert in one line
msg = es.prompt("welcome").vars(name="Alice").openai()
# Or step by step
prompt = es.prompt("welcome").get()
rendered = prompt.with_vars(name="Alice")
message = rendered.openai()
# Fetch a specific version
v1 = es.prompt("welcome").version("1.0.0").get()
# Short version alias
v2 = es.prompt("welcome").v("2.0.0").get()
Provider Support
OpenAI
from openai import OpenAI
message = prompt.with_vars(name="Alice").openai(role="system")
config = prompt.openai_config()
client = OpenAI()
response = client.chat.completions.create(
**config,
messages=[message]
)
Anthropic
import anthropic
# As user message
message = prompt.with_vars(name="Bob").anthropic()
# As system message (Anthropic handles system separately)
system = prompt.anthropic_system()
config = prompt.anthropic_config()
client = anthropic.Anthropic()
response = client.messages.create(
**config,
system=system,
messages=[{"role": "user", "content": "Hello!"}]
)
Google / Gemini
message = prompt.google(role="user")
# or
message = prompt.gemini()
config = prompt.google_config()
Vercel AI SDK (for Node.js interop)
message = prompt.vercel(role="system")
LangChain
from langchain.prompts import PromptTemplate
# As message
message = prompt.langchain(message_type="human")
# As template (with input variables)
template, input_variables = prompt.langchain_template()
prompt_template = PromptTemplate.from_template(template)
Connect to Any PLP Server
The SDK works with any PLP-compliant prompt library:
import os
# Echostash Cloud
es = Echostash("https://api.echostash.com", api_key="sk_...")
# Local PLP server
local = Echostash("http://localhost:3000")
# Your company's prompt registry
corp = Echostash(
"https://prompts.mycompany.com",
api_key=os.environ["PROMPT_API_KEY"]
)
# Any PLP-compliant service
other = Echostash("https://plp.example.com")
Working with Prompts
Fetch Prompts
# Latest version
prompt = es.prompt("marketing/welcome").get()
# Specific version
v1 = es.prompt("marketing/welcome").version("1.0.0").get()
# With variables pre-set
prompt = es.prompt("welcome").vars(name="Alice").get()
Access Content
prompt = es.prompt("welcome").get()
# Raw content (string or list of ContentBlock)
raw = prompt.raw()
# As plain text
text = prompt.text()
# As string (same as text)
print(str(prompt))
Save Prompts
es.save(
"my-new-prompt",
content="Hello {{name}}!",
meta={
"version": "1.0.0",
"author": "me"
}
)
Delete Prompts
es.delete("my-old-prompt")
Server Discovery
info = es.discover()
print(info["plp_version"]) # "1.0"
print(info["capabilities"]) # {"versioning": True, ...}
Context Manager Support
with Echostash("https://api.echostash.com", api_key="sk_...") as es:
prompt = es.prompt("welcome").get()
# Connection is properly closed after the block
Type Hints
Full type hint support:
from echostash import (
Prompt,
PromptContent,
PromptMeta,
ModelConfig,
LoadedPrompt,
)
from echostash.types import (
OpenAIMessage,
AnthropicMessage,
GoogleMessage,
VercelMessage,
LangChainMessage,
)
Advanced: Direct Provider Functions
For advanced use cases, you can import provider functions directly:
from echostash.providers import (
to_openai,
to_anthropic,
to_google,
to_vercel,
to_langchain,
extract_openai_config,
)
content = "Hello {{name}}!"
message = to_openai(content, role="system")
Configuration
es = Echostash(
"https://api.echostash.com",
# API key for authentication
api_key="sk_...",
# Custom headers
headers={
"X-Custom-Header": "value"
},
# Request timeout (seconds)
timeout=10,
# Default parameter symbol for variable substitution
default_parameter_symbol="{{}}"
)
Error Handling
from echostash import EchostashError
try:
prompt = es.prompt("not-found").get()
except EchostashError as e:
print(e.args[0]) # "HTTP 404"
print(e.status_code) # 404
License
MIT
Metadata
Release files for echostash 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| echostash-1.2.0.tar.gz | 16.2 kB | Without provenance | Details for echostash-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| echostash-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for echostash-1.2.0-py3-none-any.whl |
Total release size: 33.5 kB
Release files / echostash-1.2.0.tar.gz
| Download URL | echostash-1.2.0.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
801aa782f22c56f09cfa55da698e5ebbfa1ff3840fae534d31b0de688d008d99
|
|
BLAKE2b-256 checksum How to use checksums |
2c7b7cd3e5febe3a45582dcbdccd082a998d5e19865abc6d8f3b1742a4f72f12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / echostash-1.2.0-py3-none-any.whl
| Download URL | echostash-1.2.0-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e267586708fd45692a332027792e2587d1b73075da3826c697339d5b80923e1
|
|
BLAKE2b-256 checksum How to use checksums |
13fe3c379a37079398cdc425c3a7dad82c7283e607bf0e8e0a371d05a4fe6661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for echostash 1.2.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.