ChatGPT API Cost: What It Costs to Analyze 2,000 Security Events
ChatGPT API cost can look straightforward when pricing is expressed per million tokens. In practice, however, the cost of an AI workload depends heavily on how much information the model needs to analyze and how much output it generates.
At HuntCode, we can see this directly in our agentic threat intelligence workflow. A single threat intelligence run analyzed a sample of 2,000 security events collected from 36,848 web application firewall events observed during a 30-day window.
That analysis consumed approximately 232,836 input tokens and 7,032 output tokens. The large difference between input and output illustrates an important part of AI economics: analytical workloads can require the model to process far more information than it ultimately returns.
This creates an engineering question that goes beyond the price of an individual API call: how do you give an AI agent enough security context to produce useful analysis without making every run unnecessarily expensive?
How OpenAI API Pricing Works
People searching for ChatGPT API cost are generally referring to the cost of using OpenAI models programmatically through the OpenAI API. Unlike a ChatGPT subscription, API usage is typically metered based on the model and the number of tokens processed.
Tokens represent pieces of the information processed or generated by a model. For text workloads, API cost generally includes two important categories:
- Input tokens: Information sent to the model, including instructions, context, structured data, and other evidence.
- Output tokens: Information generated by the model in response.
Some workloads may also benefit from cached input pricing when eligible content can be reused. The exact rates depend on the model, so developers should check current OpenAI pricing before estimating production costs.
A Real Threat Intelligence Workload
HuntCode's threat intelligence workflow provides a useful example because security analysis can be highly input-heavy.
During one completed run, HuntCode analyzed 2,000 sampled AWS WAF events from a 30-day window containing 36,848 total events.
The sampled telemetry represented a mixture of blocked and allowed requests, geographic activity, request methods, user agents, application paths, security rule matches, crawler traffic, and other signals.
The objective was not simply to summarize 2,000 log entries. The agent was given enough structured evidence to identify relationships across the events and turn those observations into investigative findings.
Why 2,000 Security Events Can Consume So Many Tokens
Security telemetry can contain a surprising amount of information. A single web request may contribute multiple dimensions that become relevant during analysis.
- Request URI or application path
- HTTP method
- Allow or block action
- Geographic information
- User-agent information
- Security rule matches
- Threat or signal classifications
- Associated labels and metadata
Multiply those characteristics across thousands of events and the amount of context grows quickly.
For the HuntCode run examined here, the resulting workload used approximately 232,836 input tokens. The final response used approximately 7,032 output tokens.
That means the overwhelming majority of the token volume was associated with the information being analyzed rather than the final analysis being returned.
What Did the Agent Find?
The token usage becomes more meaningful when viewed alongside the work the agent performed.
The analysis identified patterns that included widespread probing of PHP and WordPress paths, reconnaissance against sensitive configuration and repository resources, automated HTTP clients, crawler activity, suspicious POST activity, and differences between potentially hostile automation and legitimate crawlers.
For example, the analysis identified repeated requests targeting paths associated with environment files, source-control artifacts, WordPress components, PHP files, administrative interfaces, API documentation, and other potentially sensitive resources.
At the same time, the telemetry contained legitimate automated traffic from search engines, AI crawlers, SEO crawlers, and certificate-validation infrastructure. That distinction matters because high-volume automated traffic is not automatically malicious.
The output therefore went beyond a single summary. The workflow generated structured information including:
- Findings: Patterns identified across the security telemetry.
- Evidence: Observable events supporting individual findings.
- Severity: An indication of the potential importance of a finding.
- Interpretation: Context describing why an observed pattern may matter.
- Endpoint trends: Patterns associated with particular application paths.
- User-agent analysis: Interpretation of crawlers, scanners, HTTP clients, and other automated traffic.
- Recommendations: Defensive actions for an operator or analyst to consider.
What Did the API Call Cost?
The threat intelligence run used GPT-5.5. At the time of this analysis, the applicable API rates were $5 per million input tokens and $30 per million output tokens. Based on those rates, the approximate cost can be calculated from the recorded token usage.
- Input: 232,836 tokens ÷ 1,000,000 × $5 ≈ $1.16
- Output: 7,032 tokens ÷ 1,000,000 × $30 ≈ $0.21
- Estimated total: approximately $1.38
This is an estimate based on the recorded token counts and the API pricing applicable at the time of the analysis. API models and pricing change over time, so current workloads should be calculated using the pricing available when they are executed. Actual billing can also vary depending on factors such as caching and service tier.
A cost of roughly $1.38 for an individual analytical job may not appear large. The economics become more important when the same architecture begins operating repeatedly or autonomously.
The Cost Changes When Agents Run at Scale
One API call is only part of the engineering problem. Agentic systems can potentially execute the same type of analysis many times as new information becomes available.
If an equivalent workload cost approximately $1.38 per run, the theoretical token cost would scale roughly like this if each run consumed a similar number of tokens:
- 10 runs: approximately $13.80
- 100 runs: approximately $138
- 1,000 runs: approximately $1,380
Real workloads will not have identical token usage, so these figures are illustrations rather than forecasts. Different telemetry windows, event sizes, model outputs, caching behavior, and analysis strategies can all change the actual cost.
But the scaling relationship highlights an important architectural consideration: deciding when expensive analysis is necessary can become almost as important as deciding what the model should analyze.
Why HuntCode Does Not Send Every Security Event Directly to AI
One approach would be to continuously send raw security events to an AI model as they arrive. That can be unnecessary and expensive, especially when deterministic software can perform much of the initial processing more efficiently.
HuntCode instead separates deterministic processing from AI interpretation. Traditional software can collect, filter, count, group, and aggregate telemetry before an AI agent is invoked for deeper analysis.
This creates a hybrid workflow:
- Security controls generate and enforce deterministic security decisions.
- Data processing organizes and reduces the resulting telemetry.
- AI analysis interprets the relevant evidence and produces structured findings.
- Human review evaluates findings that may require investigation or action.
This separation matters for reliability, but it also matters for cost. Every piece of context sent to a model can contribute to token usage. Reducing irrelevant information before inference can therefore improve both the analytical signal and the economics of the workflow.
More Context Is Not Always Better
Large context windows make it possible for AI models to analyze substantial amounts of information, but the ability to send more data does not mean every available event should be included.
For security analysis, the objective should be to preserve enough evidence to identify meaningful relationships without filling the context with redundant or low-value telemetry.
That creates several optimization opportunities:
- Filtering: Remove events that are irrelevant to the analytical objective.
- Aggregation: Represent repeated activity as useful statistics or patterns where appropriate.
- Sampling: Analyze representative subsets when processing every event is unnecessary.
- Caching: Reuse eligible context instead of repeatedly processing identical information.
- Triggering: Run deeper analysis when predefined changes or conditions justify the additional computation.
Token optimization should not mean removing evidence merely to make a request cheaper. The more useful goal is to reduce unnecessary context while preserving the information required to support trustworthy findings.
API Cost Becomes an Architecture Problem
For simple applications, API cost can sometimes be estimated from the price of an individual prompt and response. Agentic systems make the calculation more complicated.
A production workflow may have to consider how frequently agents execute, how much evidence each job receives, whether context can be cached, which model is appropriate for the task, how much output is necessary, and what conditions should trigger another run.
This becomes particularly important as systems move from manually initiated execution toward greater autonomy.
An autonomous threat intelligence system does not necessarily need an AI model continuously analyzing every incoming request. Deterministic monitoring can watch high-volume telemetry and invoke deeper AI analysis when a meaningful change, threshold, or security condition occurs.
That architecture can place the more expensive reasoning layer where it potentially provides the most value.
From API Pricing to Agent Economics
The cost of an AI agent is ultimately more than the published price of a model.
Two applications using the same model can have dramatically different economics because one may send a few thousand tokens per request while another analyzes hundreds of thousands.
For HuntCode's threat intelligence workflow, analyzing 2,000 sampled security events required approximately 233,000 input tokens. That makes input size, telemetry preparation, run frequency, and triggering strategy important parts of the architecture—not merely billing details.
As HuntCode continues developing its agentic execution and autonomy layers, these economics become part of the same broader engineering problem: determining what an agent should analyze, when the analysis should happen, and how much context is actually necessary to produce useful evidence-backed findings.
Explore HuntCode
HuntCode is building hands-on cybersecurity learning experiences around practical defensive skills, AI-powered guidance, agentic workflows, threat intelligence, and real security operations concepts.
- Related: Read AI Agents: From Execution to Autonomy to explore how HuntCode is approaching agentic execution, event-driven workflows, grounding, and human oversight.
- Learners: Explore HuntCode to develop practical cybersecurity skills through lessons, labs, and AI-powered learning experiences.
- More from HuntCode: Follow our blog for engineering articles on AI agents, threat intelligence, network security, and hands-on cyber defense.
The price of an AI model is only the starting point. In agentic systems, the real economics depend on how much evidence an agent analyzes, how often it runs, and whether the architecture can determine when deeper reasoning is actually necessary.