Get Model Pricing
curl --request GET \
--url https://api.swarms.world/v1/models/pricing \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.swarms.world/v1/models/pricing"
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/models/pricing', 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/models/pricing",
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/models/pricing"
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/models/pricing")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/models/pricing")
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{
"model_name": "<string>",
"input_cost_per_1m": 123,
"output_cost_per_1m": 123,
"price_source": "<string>",
"timestamp": "<string>",
"status": "success"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Models
Get Model Pricing
Get what one model costs per 1M input and output tokens, including the service fee.
GET
/
v1
/
models
/
pricing
Get Model Pricing
curl --request GET \
--url https://api.swarms.world/v1/models/pricing \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.swarms.world/v1/models/pricing"
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/models/pricing', 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/models/pricing",
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/models/pricing"
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/models/pricing")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/models/pricing")
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{
"model_name": "<string>",
"input_cost_per_1m": 123,
"output_cost_per_1m": 123,
"price_source": "<string>",
"timestamp": "<string>",
"status": "success"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Query Parameters
The model to price, e.g. gpt-5.4 or openrouter/moonshotai/kimi-k3.
Minimum string length:
1Response
Successful Response
Response for GET /v1/models/pricing: one model's price per 1M tokens.
The model that was priced.
Price per 1M input tokens (USD), including the service fee.
Price per 1M output tokens (USD), including the service fee.
Where the price came from: 'openrouter', 'litellm' or 'fallback'.
ISO timestamp when the price was looked up.
The status of the request.
Was this page helpful?