Introduction
The Local Axiom API lets you send conversational prompts to a local AI model and receive instant responses. All processing is performed on our own servers, keeping your data private however requests can be slow. For now only the clearnet site has API access this will be changed soon.
Authentication & Rate Limiting
The API is open, you simply POST to https://local-axiom.com/api/chat.
Requests are rate-limited per session. A session ID is automatically
generated on the first request and returned in the X-Session-Id
header. Include this header in subsequent requests to stay within the
allotted quota.
Example header: X-Session-Id: abcdef1234567890
Request Format
Send a POST request with Content-Type:
application/json. The payload must contain the following
keys:
- model Name of the model to use (e.g.
qwen3_4b) - system_prompt Optional system prompt that sets the behaviour of the AI
- messages Array of chat messages in the form
{ role: "user" | "assistant", content: "..." }
Below is a minimal example payload.
Response Format
The API returns JSON with a single field message
containing the assistant's reply. If the reply is a JSON object,
the raw string is returned and you should parse it yourself.
Examples
Below are two complete examples: a simple curl
request and a Python agent that interacts with the API in
an automated workflow.
Curl Example
curl -X POST https://local-axiom.com/api/chat \\
-H "Content-Type: application/json" \\
-d '{
"model": "qwen3_4b",
"system_prompt": "You are a helpful programming assistant",
"messages": [
{
"role": "user",
"content": "Write a Python web server"
}
]
}'
Python Agent Example
import requests, json, re, urllib3, os, time
# ----------------------------------------------------
# Configuration
# ----------------------------------------------------
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
API_URL = "https://local-axiom.com/api/chat"
MODEL = "qwen3_4b"
# ----------------------------------------------------
# System Prompts
# ----------------------------------------------------
DEV_PROMPT = """
You are a Developer Agent. Your goal is to write code and create files to complete a task.
Respond ONLY with a JSON object:
{"action": "create_file", "path": "file.py", "content": "..."}
{"action": "complete", "message": "finished"}
If you receive 'CRITIC FEEDBACK', use it to fix your code.
"""
CRITIC_PROMPT = """
You are a Senior Code Reviewer.
Review the code provided by the developer.
1. If the code is perfect and meets all requirements, respond ONLY with: {"status": "PASS"}
2. If there are errors, bugs, or missing features, respond with: {"status": "FAIL", "feedback": "Detailed explanation of what to fix"}
"""
def extract_json(text):
try:
match = re.search(r'(\{.*\})', text, re.DOTALL)
return json.loads(match.group(1)) if match else None
except:
return None
def call_axiom(system_prompt, messages, session_id=None):
payload = {
"model": MODEL,
"system_prompt": system_prompt,
"messages": messages
}
headers = {"Content-Type": "application/json"}
if session_id:
headers["X-Session-Id"] = session_id
try:
response = requests.post(API_URL, json=payload, headers=headers,
verify=False, timeout=60)
resp_json = response.json()
# Grab session ID from header if present
new_session = response.headers.get("X-Session-Id")
return resp_json.get("message", ""), new_session
except Exception as e:
return f"Error: {str(e)}", None
def run_task(task_description):
dev_messages = [{"role": "user", "content": f"Task: {task_description}"}]
session_id = None
print(f"\n?? Starting: {task_description}")
for step in range(5): # limit to 5 iterations
raw_res, session_id = call_axiom(DEV_PROMPT, dev_messages, session_id)
data = extract_json(raw_res)
if not data:
dev_messages.append({"role": "user", "content": "Please only output JSON."})
continue
if data.get("action") == "create_file":
path, content = data.get("path"), data.get("content")
with open(path, "w") as f:
f.write(content)
print(f"??? Dev: Created {path}")
# Critic review
print(f"?? Critic: Reviewing {path}...")
critic_input = [{"role": "user",
"content": f"Task was: {task_description}\nCode written:\n{content}"}]
critic_res, _ = call_axiom(CRITIC_PROMPT, critic_input, session_id)
review = extract_json(critic_res)
if review and review.get("status") == "PASS":
print("? Critic: Code looks good! Task Complete.")
return
elif review and review.get("status") == "FAIL":
feedback = review.get("feedback")
print(f"? Critic Feedback: {feedback}")
dev_messages.append({"role": "assistant", "content": raw_res})
dev_messages.append({"role": "user",
"content": f"CRITIC FEEDBACK: {feedback}. Please fix the code and recreate the file."})
else:
print("?? Critic gave invalid response, assuming pass.")
return
elif data.get("action") == "complete":
print(f"? Dev marked task as complete.")
break
if __name__ == "__main__":
task = input("Enter task: ")
if task:
run_task(task)
FAQ
What models are available?
The API exposes a all available models: gpt_oss_20b gemma3_27b gemma3_27b gemma3_1b gemma3_27b qwen3_4b qwen3_coder_30b llama3_1_8b chan_AI_Uncensored chan_AI_Censored.
Do I need an API key?
No. API keys are not a private way for API access. All requests are rate-limited per session instead.