Welcome to the NeuroCLI platform documentation. Learn how to integrate our sovereign AI infrastructure into your applications.
The NeuroCLI API allows you to access powerful Large Language Models directly from your codebase. It is designed to be fully compatible with the industry-standard OpenAI schema, meaning you can often switch to NeuroCLI simply by changing the base URL and API key.
If you are building in Python, we strongly recommend using the NeuroCLI SDK for built-in retries, type hints, and asynchronous support.
Get up and running with the NeuroCLI API in under a minute.
Navigate to the API Dashboard and generate a secret key. Do not share this key or expose it in client-side code like browsers or mobile apps.
You can use standard HTTP clients to interact with the API. Here is a basic cURL request to generate a chat completion:
curl https://neurocli.example.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NEUROCLI_API_KEY" \
-d '{
"model": "neurocli medical gamma",
"messages": [{"role": "user", "content": "Hello!"}]
}'
NeuroCLI comes with a built-in command line interface for quick workflows directly from your terminal.
These commands are only available in neurocli-sdk version 0.4.0 and above. Ensure your SDK is updated.
Ensure that you have set your API key as an environment variable before using the CLI:
# Windows
set NEUROCLI_API_KEY=your_api_key
# Mac/Linux
export NEUROCLI_API_KEY=your_api_key
The following commands are available out of the box:
Automatically generate a boilerplate application so you don't have to start from scratch.
neurocli init # Generates a Python script (neurocli_app.py)
python -m neurocli.cli init # Failsafe alternative if neurocli is not in PATH
neurocli init --lang python # Generates a Python script
neurocli init --lang node # Generates a Node.js script (neurocli_app.js)
Verify your configuration and test your active API connection.
neurocli stats
Launch an interactive, terminal-based chat session to test the neurocli medical gamma model natively without writing a script.
neurocli chat
If your terminal says The term 'neurocli' is not recognized, your Python Scripts directory might not be in your system's PATH variable.
You can bypass this by running the module directly via Python:
python -m neurocli.cli stats
Or by using the full absolute path to the executable (replace YourUsername and Python3XX with your specific installation details):
C:\Users\YourUsername\AppData\Roaming\Python\Python314\Scripts\neurocli stats
NeuroCLI offers a range of models optimized for different tasks, speeds, and price points.
| Model ID | Description | Context Window |
|---|---|---|
neurocli medical gamma |
Our most capable model. Best for complex reasoning, logic, and coding tasks. | 128k tokens |
neurocli-delta |
Extremely fast and lightweight. Ideal for simple classification and rapid responses. | 8k tokens |
neurocli-vision |
Multimodal variant capable of understanding text and high-resolution images. | 32k tokens |
Free tier usage defaults to the neurocli-nano and neurocli-delta models. Premium models are limited to 150 requests per day.
Process medical forms and analyze real-time patient data in seconds.
The NeuroCLI Medical API is powered by neurocli-medical-gamma, an LLM fine-tuned specifically on medical literature and clinical workflows. It guarantees rapid data ingestion for near-instant form processing and diagnostic reasoning.
Send unstructured clinical notes or raw forms, and the reasoning core will extract key entities, suggest diagnostic pathways, and structure the data securely.
from neurocli import AsyncNeuroCLI
import asyncio
client = AsyncNeuroCLI(api_key="PASTE_API_KEY_HERE")
async def process_intake(notes: str):
# Analyzes medical forms in seconds
response = await client.medical.reasoning.create(
model="neurocli-medical-gamma",
data=notes,
realtime_sync=True
)
print(response.extracted_entities)
print(response.clinical_summary)
asyncio.run(process_intake("Patient presents with..."))
import { NeuroCLI } from 'neurocli-sdk';
const client = new NeuroCLI({
apiKey: 'PASTE_API_KEY_HERE'
});
async function processIntake(notes: string) {
console.log("Calling Medical API...");
try {
const response = await client.medical.reasoning.create({
model: 'neurocli-medical-gamma',
data: notes,
realtime_sync: true
});
console.log("\nā
Response received:");
console.log(response.extracted_entities);
} catch (err) {
console.error("ā Error:", err);
}
}
processIntake('Patient presents with severe headache and nausea.');
Always route PII and PHI data through the designated client.medical endpoints to utilize our zero-retention compliance layer (Enterprise feature).
The core Chat Completions API allows models to respond to conversational inputs.
Chat models take a list of messages as input and return a model-generated message as output. Each message has a role (system, user, or assistant) and content.
Receive responses in real-time as they are generated by the model.
By setting stream: true in your request payload, the API will return Server-Sent Events (SSE). This significantly improves the perceived latency for your end users.
from neurocli import NeuroCLI
client = NeuroCLI(api_key="PASTE_API_KEY_HERE")
response = client.chat.completions.create(
model="neurocli-nano",
messages=[{"role": "user", "content": "Write a poem."}],
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
import { NeuroCLI } from 'neurocli-sdk';
const client = new NeuroCLI({ apiKey: 'PASTE_API_KEY_HERE' });
const stream = await client.chat.completions.create({
model: 'neurocli-delta',
messages: [{ role: 'user', content: 'Write a poem.' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
Best practices for getting optimal results from NeuroCLI models.
LLMs are highly sensitive to how instructions are phrased. Follow these tips:
Connect NeuroCLI models to external tools and APIs.
You can describe functions to the model, and it will intelligently choose to output a JSON object containing arguments to call those functions. This allows you to fetch real-time data or perform actions.
The model does not execute the function itself. It simply returns the required arguments. Your application code must execute the function and pass the result back to the model.
Leverage user interactions to continuously train your models.
The Gamified Reinforcement Learning from Human Feedback (RLHF) feature allows you to collect high-quality preference data directly from the chat UI.
export_training_data.py utility script to fine-tune new models automatically.python export_training_data.py
This will generate a training_data.jsonl file ready to be used as a dataset for LLM fine-tuning pipelines.
Navigate the NeuroCLI API Dashboard efficiently.
The new NeuroCLI dashboard introduces premium developer features designed to make your workflow seamless.
Ctrl + K anywhere on the dashboard to open the quick-search palette. You can instantly jump to webhooks, logs, or toggle settings.Organize and secure your access using highly granular permissions.
The NeuroCLI dashboard allows you to generate multiple API keys. Each key can be restricted to specific models or actions, helping you control costs and improve security. Available scopes include:
If a key with a restricted scope attempts to access an unauthorized model, the backend immediately rejects the request with a 403 Forbidden error.
POST /api/generate_key: Creates a new scoped API key. Requires name and scope in the JSON payload.POST /api/delete_key: Revokes an existing API key immediately. Requires the key's id.curl -X POST https://api.neurocli.com/api/generate_key \
-H "Content-Type: application/json" \
-H "Cookie: session=YOUR_SESSION_COOKIE" \
-d '{"name": "Production Key", "scope": "Full Access"}'
Always rotate keys if you suspect they have been compromised. Using multiple keys ensures you can revoke access for a single compromised service without affecting others.
Receive real-time event notifications and quota alerts.
Webhooks: Allow your application to receive asynchronous HTTP POST payloads when specific events occur within your account, such as a background task completing.
Usage Alerts & Notifications: You can set an Alert Threshold (e.g., 80%) and a Notification Email. The NeuroCLI backend natively tracks your monthly usage, and triggers an alert when your volume crosses this threshold, ensuring you are never caught off guard by rate limits.
Smart Webhook Retries: On the Webhooks page, you can test your endpoints instantly by clicking the Test button next to any webhook. It will send a sample payload and visually confirm the HTTP response code (e.g., Sent (200)).
POST /api/webhooks: Registers a new webhook. Requires target_url and event_type (e.g., all, billing.limit_reached).POST /api/webhooks/retry: Manually test an existing webhook. Requires webhook_id.POST /api/webhooks/delete: Deletes an existing webhook by id.curl -X POST https://api.neurocli.com/api/webhooks \
-H "Content-Type: application/json" \
-H "Cookie: session=YOUR_SESSION_COOKIE" \
-d '{"target_url": "https://myapp.com/webhook", "event_type": "all"}'
Version control your system prompts directly in the NeuroCLI Dashboard.
Instead of hardcoding massive system prompts directly inside your source code, NeuroCLI allows you to save and manage prompts remotely.
prompt_id="pr_123" in the SDK and the backend will inject the prompt automatically.Route traffic between multiple models to evaluate performance.
NeuroCLI's A/B Testing routing allows you to split inference traffic between two models based on a defined percentage (e.g., 50% / 50%).
model="abtest_123") and NeuroCLI handles the rest.Zero-touch model distillation for your highest volume prompts.
A completely unique feature only available in NeuroCLI. Shadow Distillation allows you to capture output from expensive, powerful models (like neurocli medical gamma) and automatically use that data to fine-tune and switch over to a cheaper model (like neurocli-nano).
Share workspaces, API keys, and billing accounts with your team.
NeuroCLI now supports Organizations. You can invite team members to a shared workspace. All API Keys and Request Logs are tied to the organization (via org_id) rather than a single individual. This allows your team to collaborate seamlessly, manage shared keys, and view aggregate analytics.
Monitor your application's API usage and inspect payloads.
The NeuroCLI dashboard provides a comprehensive Request Debugger that displays your recent API calls, including the timestamp, endpoint hit, the model used, the HTTP status code, and precise latency measurements.
Payload Debugging: We log the exact JSON payload sent in every request. You can click the View Payload button next to any log entry to instantly inspect the raw JSON that was transmitted, making debugging incredibly easy.
Test models instantly within your browser with streaming and history.
The Interactive API Playground allows you to select a model, adjust temperature, and set a system prompt without writing any code.
Cryptographically prove that your data is wiped instantly.
For healthcare, finance, and defense sectors, data sovereignty is paramount. NeuroCLI offers an industry-first feature: self_destruct. When you pass this parameter, we guarantee that your payload bypasses all database logging, and the RAM space is securely zeroed out immediately after the response is sent.
{
"model": "neurocli-delta",
"messages": [{"role": "user", "content": "Analyze patient record."}],
"self_destruct": true
}
Verification: Upon completion, the API returns an X-Proof-Of-Deletion header containing a SHA-256 hash. This hash is permanently written to our immutable public ledger, allowing your compliance teams to audit and verify that no PII was retained.
Never write another parser or retry loop again.
LLMs occasionally fail to output the exact structure required (e.g., JSON schemas or specific regex patterns). With NeuroCLI, you can offload validation directly to our backend by passing a validation object in your payload.
{
"model": "neurocli-delta",
"messages": [{"role": "user", "content": "Generate a user ID."}],
"validation": {
"type": "regex",
"pattern": "^USER_\\d{5}$",
"max_retries": 3
}
}
If the AI's output fails the regex, the server intercepts the response, appends an error message to the prompt, and automatically retries on your behalf until it succeeds or hits the retry limit.
Bring Your Own Hardware for ultimate data security.
The NeuroCLI Python SDK includes a built-in Hybrid Router. By setting hybrid_routing=True, the SDK activates a local PIIScanner before transmitting your payload.
If highly sensitive Personally Identifiable Information (like SSNs or Credit Card numbers) is detected in your prompt, the SDK transparently blocks the outbound request and re-routes it to your configured fallback (which defaults to the https://neurocli.in/api/isolated Enterprise Isolated Cluster).
from neurocli import NeuroCLI
client = NeuroCLI(api_key="your_key")
response = client.chat.completions.create(
model="neurocli-delta",
messages=[{"role": "user", "content": "My SSN is 123-45-6789. Can you process my loan?"}],
hybrid_routing=True
)
# Automatically routed to the secure isolated cluster because PII was detected!
Eliminate AI hallucinations by orchestrating a debate between three specialized agents behind a single API endpoint.
The Swarm API ensures extreme accuracy and safety by utilizing an internal peer-review process:
curl -X POST https://neurocli.in/v1/swarm/chat \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "neurocli-swarm-engine",
"messages": [
{
"role": "user",
"content": "Is it safe to mix Lisinopril and Spironolactone?"
}
]
}'
from neurocli import NeuroCLI
client = NeuroCLI(api_key="YOUR_API_KEY")
response = client.swarm.chat(
model="neurocli-swarm-engine",
messages=[
{"role": "user", "content": "Is it safe to mix Lisinopril and Spironolactone?"}
]
)
# The final verified answer
print(response.choices[0].message.content)
# View the internal multi-agent debate
for entry in response.transcript:
print(f"{entry['agent']}: {entry['content']}")
The response includes the final optimized answer in the standard choices array, alongside a transcript array documenting the internal multi-agent debate.
{
"id": "swarm-123",
"object": "chat.completion",
"created": 1718544000,
"model": "neurocli-swarm-engine",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Co-administration significantly increases the risk of severe hyperkalemia. Close monitoring is required."
},
"finish_reason": "stop"
}
],
"transcript": [
{
"agent": "Model A (Expert)",
"content": "Lisinopril and Spironolactone can be mixed but may cause hyperkalemia."
},
{
"agent": "Model B (Critic)",
"content": "The initial answer downplays the severity. It must explicitly highlight the risk of severe hyperkalemia and recommend monitoring."
},
{
"agent": "Model C (Judge)",
"content": "Co-administration significantly increases the risk of severe hyperkalemia. Close monitoring is required."
}
]
}