X API cost calculator API
Enter what your app posts and reads on X in a month and see the pay-per-use bill line by line, including what links in posts add.
- Endpoint:
POST https://postboost.co/app/api/tools/x-api-cost-calculator(operationIdcalculateXApiCost) - Web tool: postboost.co/tools/x-api-cost-calculator
- Token: optional (limits)
- MCP: tool
calculate-x-api-costonhttps://postboost.co/mcp/tools
Request
| Field | Type | Default | Description |
|---|---|---|---|
posts | integer | 0 | Posts created per month, with or without a link. |
link_share | integer | 0 | Percent of those posts that contain a URL (billed at the link-post price). |
replies | integer | 0 | Summoned replies per month. |
post_reads | integer | 0 | Posts read per month. |
user_reads | integer | 0 | Users read per month. |
owned_reads | integer | 0 | Owned resources read per month (your own posts, followers and so on). |
Call it
- curl
- Python
- Node.js
- PHP
- Go
- Ruby
- Java
- C#
- Rust
- CLI
curl -X POST https://postboost.co/app/api/tools/x-api-cost-calculator \
-H 'Content-Type: application/json' \
-d '{"posts":1000,"link_share":20}'
from postboost import ApiClient, Configuration
from postboost.api.free_tools_api import FreeToolsApi
from postboost.models import FreeToolCalculateXApiCostRequest
with ApiClient(Configuration()) as client:
api = FreeToolsApi(client)
result = api.calculate_x_api_cost(FreeToolCalculateXApiCostRequest.from_dict({"posts": 1000, "link_share": 20}))
print(result.to_dict())
import { FreeToolsApi } from 'postboost';
const api = new FreeToolsApi();
const { body } = await api.calculateXApiCost({ posts: 1000, linkShare: 20 });
console.log(body);
use PostBoostClient\Api\FreeToolsApi;
use PostBoostClient\Model\FreeToolCalculateXApiCostRequest;
$api = new FreeToolsApi(new GuzzleHttp\Client());
$result = $api->calculateXApiCost(new FreeToolCalculateXApiCostRequest(['posts' => 1000, 'link_share' => 20]));
echo $result;
import (
"context"
"encoding/json"
"fmt"
postboost "github.com/postboost-co/postboost-go"
)
var request postboost.FreeToolCalculateXApiCostRequest
if err := json.Unmarshal([]byte(`{"posts":1000,"link_share":20}`), &request); err != nil {
panic(err)
}
client := postboost.NewAPIClient(postboost.NewConfiguration())
result, _, err := client.FreeToolsAPI.CalculateXApiCost(context.Background()).FreeToolCalculateXApiCostRequest(request).Execute()
fmt.Println(result, err)
require 'postboost'
api = PostBoost::FreeToolsApi.new
result = api.calculate_x_api_cost(PostBoost::FreeToolCalculateXApiCostRequest.new({ posts: 1000, link_share: 20 }))
puts result.to_hash
import com.postboost.ApiClient;
import com.postboost.api.FreeToolsApi;
import com.postboost.model.FreeToolCalculateXApiCostRequest;
import com.postboost.model.FreeToolCalculateXApiCostResponse;
FreeToolsApi api = new FreeToolsApi(new ApiClient());
FreeToolCalculateXApiCostRequest request = FreeToolCalculateXApiCostRequest.fromJson("{\"posts\":1000,\"link_share\":20}");
FreeToolCalculateXApiCostResponse result = api.calculateXApiCost(request);
System.out.println(result.toJson());
using Newtonsoft.Json;
using PostBoost.Client.Api;
using PostBoost.Client.Client;
using PostBoost.Client.Model;
var api = new FreeToolsApi(new Configuration());
var request = JsonConvert.DeserializeObject<FreeToolCalculateXApiCostRequest>(@"{""posts"":1000,""link_share"":20}");
var result = await api.CalculateXApiCostAsync(request);
Console.WriteLine(result.ToJson());
use postboost::apis::configuration::Configuration;
use postboost::apis::free_tools_api;
use postboost::models::FreeToolCalculateXApiCostRequest;
let config = Configuration::new();
let request: FreeToolCalculateXApiCostRequest = serde_json::from_str(r##"{"posts":1000,"link_share":20}"##)?;
let result = free_tools_api::calculate_x_api_cost(&config, request).await?;
println!("{:?}", result);
echo '{"posts":1000,"link_share":20}' | ./postboost-cli --content-type application/json calculateXApiCost -
With a token, send Authorization: Bearer YOUR_API_TOKEN as a default header (how, per SDK).
Response
{
"line_items": [
{
"key": "posts",
"label": "Posts without a link",
"count": 800,
"unit_usd": 0.015,
"cost_usd": 12
},
{
"key": "link_posts",
"label": "Posts with a link",
"count": 200,
"unit_usd": 0.2,
"cost_usd": 40
},
{
"key": "replies",
"label": "Summoned replies",
"count": 0,
"unit_usd": 0.01,
"cost_usd": 0
},
{
"key": "post_reads",
"label": "Post reads",
"count": 0,
"unit_usd": 0.005,
"cost_usd": 0
},
{
"key": "user_reads",
"label": "User reads",
"count": 0,
"unit_usd": 0.01,
"cost_usd": 0
},
{
"key": "owned_reads",
"label": "Owned reads",
"count": 0,
"unit_usd": 0.001,
"cost_usd": 0
}
],
"total_usd": 52,
"link_premium_usd": 37,
"notes": [
"X bills pay-per-use from prepaid credits; there is no free tier.",
"X lets you set an optional spending limit, so a busy month cannot use up your credits."
],
"prices_last_verified": "2026-10-15",
"source": "https://docs.x.com/x-api/getting-started/pricing"
}
With MCP
Connect https://postboost.co/mcp/tools (setup) and ask, for example: Calculate the monthly X API cost with the PostBoost calculate-x-api-cost tool.
Errors
| Status | When |
|---|---|
401 | The Authorization header holds an invalid token. Leave it out to call as a guest. |
413 | The JSON body is larger than 128 KB. |
422 | A field is invalid; the body lists the errors per field. |
429 | A limit is reached; see limits. |