Get Comprehensive Pricing Details
curl --request GET \
--url https://api.swarms.world/v1/usage/costs \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.swarms.world/v1/usage/costs"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://api.swarms.world/v1/usage/costs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.swarms.world/v1/usage/costs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.swarms.world/v1/usage/costs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.swarms.world/v1/usage/costs")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/usage/costs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"usage_pricing": {
"swarm_completions_agent_cost": 0.01,
"swarm_completions_input_cost_per_1m": 6.5,
"swarm_completions_output_cost_per_1m": 18.5,
"agent_completions_input_cost_per_1m": 6.5,
"agent_completions_output_cost_per_1m": 18.5,
"agent_completions_img_cost": 0.25,
"agent_completions_mcp_cost": 0.1,
"search_cost": 0.04,
"scrape_cost": 0.15,
"night_time_discount": 0.5
},
"timestamp": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Pricing
Get Comprehensive Pricing Details
Retrieves comprehensive pricing details for all API features including usage costs, service costs, and special pricing features.
GET
/
v1
/
usage
/
costs
Get Comprehensive Pricing Details
curl --request GET \
--url https://api.swarms.world/v1/usage/costs \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.swarms.world/v1/usage/costs"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://api.swarms.world/v1/usage/costs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.swarms.world/v1/usage/costs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.swarms.world/v1/usage/costs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.swarms.world/v1/usage/costs")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/usage/costs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"usage_pricing": {
"swarm_completions_agent_cost": 0.01,
"swarm_completions_input_cost_per_1m": 6.5,
"swarm_completions_output_cost_per_1m": 18.5,
"agent_completions_input_cost_per_1m": 6.5,
"agent_completions_output_cost_per_1m": 18.5,
"agent_completions_img_cost": 0.25,
"agent_completions_mcp_cost": 0.1,
"search_cost": 0.04,
"scrape_cost": 0.15,
"night_time_discount": 0.5
},
"timestamp": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Response
Successful Response
Comprehensive pricing details for all API features. Includes usage costs for all API operations and additional service costs.
Was this page helpful?
⌘I