Agent Public API
Agent Public API
The Agent Public API lets you call the Tritonix investment agent from your own server-side scripts and backend jobs. It uses the same core execution engine as Tritonix headless agent runs, including built-in research tools and expert subagents, while staying fully separate from front-end chat history. It also does not load user-connected MCP / brokerage tools.
Base Endpoint
POST https://tritonix.ai/api/v1/agent/run
Use the production domain above for live integrations. If you are testing against a local or preview deployment, replace https://tritonix.ai with that environment's base URL.
Authentication
Send your API key in the Authorization header:
Authorization: Bearer txk_your_secret_here
Content-Type: application/json
Request Body
Minimal request
{
"prompt": "Before the US market open, select 5 stocks for today's watchlist and return valid JSON.",
"model": "gemini-3.7-flash",
"response_format": {
"type": "json_object"
}
}
Fields
| Field | Required | Type | Description |
|---|---|---|---|
prompt |
Yes | string | The instruction sent to the agent |
model |
No | string | Tritonix model key. Unknown values fall back to gemini-3.7-flash |
response_format |
No | object | Output mode. Supported: text, json_object, json_schema |
Supported Models
Pass the model key as a string in the model field.
Current supported keys:
gpt-5.6-terragpt-5.6-lunaclaude-opus-5claude-sonnet-5claude-haiku-4-5gemini-3.1-pro-previewgemini-3.7-flashgrok-4.6grok-4.1-fast-reasoningdeepseek-v4-prokimi-k2.6qwen3.7-plusglm-5.2minimax-m3
Notes:
- If
modelis omitted, Tritonix usesgemini-3.7-flash - If an unknown model key is provided, Tritonix also falls back to
gemini-3.7-flash
Parameter Reference
prompt
- Type:
string - Required: Yes
- Purpose: the full instruction for the agent
- Maximum: 800,000 tokens for models with sufficient context. Tritonix automatically uses a lower effective limit for smaller-context models and truncates excess input instead of failing the request.
- The response
usageobject reportssubmitted_input_tokens,retained_input_tokens,input_token_limit, andinput_truncated.
model
- Type:
string - Required: No
- Example:
"gemini-3.7-flash"
response_format
- Type:
object - Required: No
- Default:
{ "type": "text" }
Supported values:
{ "type": "text" }
{ "type": "json_object" }
{
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"answer": { "type": "string" }
},
"required": ["answer"]
}
}
Response Formats
1. Text output
{
"prompt": "Summarize NVIDIA in plain English.",
"response_format": { "type": "text" }
}
Returns plain text in output.
2. Arbitrary JSON object
{
"prompt": "Return a JSON watchlist with tickers and reasons.",
"response_format": { "type": "json_object" }
}
Returns parsed JSON in output, without schema enforcement.
3. JSON schema output
{
"prompt": "Return exactly 3 premarket picks.",
"response_format": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"picks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ticker": { "type": "string" },
"market": { "type": "string" },
"reason": { "type": "string" }
},
"required": ["ticker", "market", "reason"]
}
}
},
"required": ["picks"]
}
}
}
Returns validated structured output in output.
Example Successful Response
{
"id": "0fdfce46-6a63-4bf2-a70e-4d7bced1f8f6",
"model": "gemini-3.7-flash",
"response_format": "json_object",
"output": {
"picks": [
{
"ticker": "NVDA",
"reason": "Earnings momentum remains strong and premarket liquidity is deep."
}
]
},
"usage": {
"prompt_tokens": 4821,
"completion_tokens": 533,
"total_tokens": 5354,
"cache_read_tokens": 0,
"cache_write_tokens": 0,
"reasoning_tokens": null,
"agent_steps": 3,
"cost_usd": 0.008019,
"credits_deducted": 3
}
}
Error Responses
Invalid API key
{
"error": "invalid_api_key"
}
Status: 401
Missing prompt
{
"error": "missing_prompt"
}
Status: 400
Insufficient credits
{
"error": "insufficient_credits",
"balance": 0
}
Status: 402
Execution failure
{
"error": "agent_run_failed",
"message": "..."
}
Status: 500
Credits Behavior
Credits follow Tritonix's existing platform logic:
- if
credits_balance <= 0before execution, the request is rejected - if
credits_balance > 0before execution, the request may run - final credits deduction happens after execution
Public API requests are also recorded in the API invocation log for dashboard analytics.
Operational Metadata
Tritonix stores request-level metadata for the public API, including:
- request status
- model
- response format
- token usage
- Credits deducted
- latency
- error code
Tritonix does not store the full prompt body or full model response body for this public API.
cURL Example
curl -X POST "https://tritonix.ai/api/v1/agent/run" \
-H "Authorization: Bearer txk_your_secret_here" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{
"model": "gemini-3.7-flash",
"prompt": "Before the market opens, return 3 US stock ideas in JSON with ticker, theme, and risk.",
"response_format": {
"type": "json_object"
}
}'
Windows PowerShell Encoding
When sending non-English prompts from Windows PowerShell, pass the JSON body as UTF-8 and set the content type explicitly:
$headers = @{ Authorization = 'Bearer txk_your_secret_here' }
$body = @{
model = 'gemini-3.7-flash'
prompt = '请用一句话介绍一下英伟达最近为什么仍然值得投资者关注。'
response_format = @{ type = 'text' }
} | ConvertTo-Json -Depth 5
$resp = Invoke-RestMethod `
-Method Post `
-Uri 'https://tritonix.ai/api/v1/agent/run' `
-Headers $headers `
-ContentType 'application/json; charset=utf-8' `
-Body ([System.Text.Encoding]::UTF8.GetBytes($body))
$resp.output