Tritonix.ai

Help Center

  • Introduction
  • AI Agent Guide
  • Tritonix Investment Agent
  • Asset Panel
  • Calendar Panel
  • Screener Panel
  • Web Search Panel
  • Document Panel
  • Skill Panel
  • Scheduled Tasks
  • Publish Ideas
  • Social Media Agent
  • Connectors
  • Copy Trade
  • Swing Trade Bot
  • Day Trade Bot
  • AI Technical Analysis
  • Advanced Indicators
  • AI Consensus Stock Pick
  • Institutional Smart Money
  • How to Use the Blog
  • API Key Management
  • Agent Public API

Help Center

Agent Public API

Agent Public API

The Agent Public API lets you call the Tritonix investment agent from your own server-side scripts, cron jobs, and backend services. It uses the same research tools and expert subagents as Tritonix Studio, but it stays outside chat history and does not load user-connected MCP or brokerage tools.

Use this page as the integration tutorial. For key creation, rotation, and request logs, see API Key Management.

Choose an Output Mode

Every request is still one HTTP call. The output mode only changes how Tritonix returns the answer.

You want Use What you get
A normal research answer response_format: { "type": "text" } Plain text in output
The same answer streamed text + "stream": true A text stream, not a JSON body
Any valid JSON json_object Parsed JSON in output, no field contract
JSON that matches your schema json_schema Validated JSON in output

json_object and json_schema research with tools first, then format the answer in a second tool-less step. You do not call the API twice.

stream is only valid with text. Combining it with json_object or json_schema returns 400 invalid_stream_request.

Getting Started

  1. Create an API key in Account Settings → API Keys. The full secret is shown only once.
  2. Send that key as a Bearer token from a trusted server.
  3. Start with a small text request before you add a schema.
POST https://tritonix.ai/api/v1/agent/run
Authorization: Bearer txk_your_secret_here
Content-Type: application/json

This is the production endpoint. Call it from your server with your API key.

Tutorial 1 — Plain Text

Use this when a person or a Slack/email job just needs a readable answer.

{
  "prompt": "Summarize NVIDIA in plain English.",
  "model": "gpt-5.6-luna",
  "response_format": { "type": "text" }
}

output is a string.

Tutorial 2 — Stream Text

Use this when you want tokens as they arrive. The HTTP body is the answer itself, not { "output": "..." }.

curl -N -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": "gpt-5.6-luna",
    "prompt": "Summarize NVIDIA in plain English.",
    "response_format": { "type": "text" },
    "stream": true
  }'

Credits and the request log are written after the stream finishes.

Tutorial 3 — Flexible JSON

Use this when your job can accept any JSON object, such as a watchlist you will inspect in code.

{
  "prompt": "Return a JSON watchlist with tickers and reasons.",
  "model": "gpt-5.6-luna",
  "response_format": { "type": "json_object" }
}

output is already parsed JSON. Tritonix checks that it is valid JSON, not that specific fields exist.

Tutorial 4 — Schema-Validated JSON

Use this when the next system needs a stable contract: a database row, a spreadsheet, or another API.

json_schema requires a JSON Schema object with type: "object" and at least one entry in properties. Missing schema, schema: {}, or an array root returns 400 invalid_response_format before the model runs.

{
  "prompt": "Return exactly 3 premarket picks.",
  "model": "gemini-3.7-flash",
  "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"]
    }
  }
}

output matches that schema. Gemini, OpenAI, and the other Public API models all use the same two-step path for this mode.

Request 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 gpt-5.6-luna
response_format No object text, json_object, or json_schema. Default: { "type": "text" }
stream No boolean Stream plain text. Only valid with text

prompt

Maximum input is 800,000 tokens on models with enough context. Smaller-context models get a lower effective limit. Extra input is truncated instead of failing the request.

The response usage object reports submitted_input_tokens, retained_input_tokens, input_token_limit, and input_truncated.

Supported models

  • gpt-5.6-terra
  • gpt-5.6-luna
  • claude-opus-5
  • claude-sonnet-5
  • claude-haiku-4-5
  • gemini-3.1-pro-preview
  • gemini-3.7-flash
  • grok-4.6
  • grok-4.1-fast-reasoning
  • deepseek-v4-pro
  • kimi-k2.6
  • qwen3.7-plus
  • glm-5.2
  • minimax-m3

If model is omitted or unknown, Tritonix uses gpt-5.6-luna.

Successful JSON Response

{
  "id": "0fdfce46-6a63-4bf2-a70e-4d7bced1f8f6",
  "model": "gpt-5.6-luna",
  "response_format": "json_schema",
  "output": {
    "picks": [
      {
        "ticker": "NVDA",
        "market": "US",
        "reason": "Earnings momentum remains strong and premarket liquidity is deep."
      }
    ]
  },
  "usage": {
    "prompt_tokens": 4821,
    "completion_tokens": 533,
    "total_tokens": 5354,
    "submitted_input_tokens": 86,
    "retained_input_tokens": 86,
    "input_token_limit": 800000,
    "input_truncated": false,
    "cache_read_tokens": 0,
    "cache_write_tokens": 0,
    "reasoning_tokens": null,
    "agent_steps": 3,
    "cost_usd": 0.008019,
    "credits_deducted": 3
  }
}

For text without stream, output is a string. For json_object and json_schema, output is an object.

Errors

Error bodies now include retryable when the request reached execution.

Status error When
401 invalid_api_key Missing or revoked key
400 missing_prompt prompt is empty
400 invalid_response_format json_schema is missing a usable object schema
400 invalid_stream_request stream: true with json_object or json_schema
402 insufficient_credits Balance is <= 0 before the run
422 structured_output_failed The model did not produce schema-valid JSON
422 invalid_model_request The upstream model rejected the request
429 rate_limited Upstream rate limit
504 agent_timeout The run timed out
502 upstream_failed Upstream provider failure
500 agent_run_failed Unexpected execution failure
{
  "error": "invalid_response_format",
  "message": "json_schema requires a non-empty object schema with properties.",
  "retryable": false
}

402 also includes balance.

Credits and Logs

Credits follow the same platform rules as Studio:

  • balance <= 0 before execution → rejected
  • balance > 0 before execution → the request may run
  • deduction happens after the run, including after a text stream finishes
  • structured runs bill both the research step and the formatting step together

The API Keys page records status, model, response format, tokens, credits, latency, and error code. Tritonix does not store the full prompt or the full model response.

cURL Examples

JSON object:

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": "gpt-5.6-luna",
    "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 = 'gpt-5.6-luna'
  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

Related Docs

  • API Key Management
  • Tritonix AI Agent