Tool Calling Example
from openai import OpenAI
client = OpenAI(
api_key="bl_live_xxxxxxxxxxxx",
base_url="https://api.breachline.io/api/v1/llm"
)
# Define security tools
tools = [
{
"type": "function",
"function": {
"name": "scan_target",
"description": "Perform a security scan on a target",
"parameters": {
"type": "object",
"properties": {
"target": {"type": "string", "description": "URL or IP to scan"},
"scan_type": {"type": "string", "enum": ["quick", "full", "stealth"]}
},
"required": ["target"]
}
}
},
{
"type": "function",
"function": {
"name": "lookup_cve",
"description": "Look up CVE details",
"parameters": {
"type": "object",
"properties": {
"cve_id": {"type": "string", "description": "CVE ID (e.g., CVE-2024-1234)"}
},
"required": ["cve_id"]
}
}
}
]
response = client.chat.completions.create(
model="nebula-pro",
messages=[{"role": "user", "content": "Scan example.com for vulnerabilities"}],
tools=tools,
tool_choice="auto"
)
# Handle tool calls
if response.choices[0].message.tool_calls:
for tool_call in response.choices[0].message.tool_calls:
print(f"Tool: {tool_call.function.name}")
print(f"Args: {tool_call.function.arguments}")Streaming Example
import asyncio
import websockets
import json
async def stream_chat():
uri = "wss://api.breachline.io/api/v1/ws"
async with websockets.connect(uri, extra_headers={
"X-API-Key": "bl_live_xxxxxxxxxxxx"
}) as ws:
# Send a chat message
await ws.send(json.dumps({
"type": "chat",
"model": "nebula-pro",
"messages": [
{"role": "user", "content": "Write a security audit report for example.com"}
]
}))
# Receive streaming chunks
async for message in ws:
data = json.loads(message)
if data.get("type") == "chunk":
print(data["content"], end="", flush=True)
elif data.get("type") == "done":
print("\n[Stream complete]")
break
asyncio.run(stream_chat())MCP Configuration
// MCP Configuration (claude_desktop_config.json)
{
"mcpServers": {
"nebula": {
"command": "npx",
"args": ["-y", "@breachline/mcp-server"],
"env": {
"NEBULA_API_KEY": "bl_live_xxxxxxxxxxxx",
"NEBULA_BASE_URL": "https://api.breachline.io/api/v1/llm"
}
}
}
}
// Use with MCP SDK
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
const client = new Client({ name: "my-app", version: "1.0.0" });
await client.connect(transport);
const result = await client.callTool({
name: "nebula_chat",
arguments: {
model: "nebula-pro",
message: "Analyze security headers for example.com"
}
});Need higher limits? Contact us for enterprise plans.