Set private endpoint pricing
curl --request PUT \
--url https://openrouter.ai/api/v1/private-endpoints/{id}/pricing \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pricing": {
"completion": "0.00001",
"prompt": "0.0000025"
}
}
'import requests
url = "https://openrouter.ai/api/v1/private-endpoints/{id}/pricing"
payload = { "pricing": {
"completion": "0.00001",
"prompt": "0.0000025"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({pricing: {completion: '0.00001', prompt: '0.0000025'}})
};
fetch('https://openrouter.ai/api/v1/private-endpoints/{id}/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://openrouter.ai/api/v1/private-endpoints/{id}/pricing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'pricing' => [
'completion' => '0.00001',
'prompt' => '0.0000025'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/private-endpoints/{id}/pricing"
payload := strings.NewReader("{\n \"pricing\": {\n \"completion\": \"0.00001\",\n \"prompt\": \"0.0000025\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://openrouter.ai/api/v1/private-endpoints/{id}/pricing")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pricing\": {\n \"completion\": \"0.00001\",\n \"prompt\": \"0.0000025\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/private-endpoints/{id}/pricing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pricing\": {\n \"completion\": \"0.00001\",\n \"prompt\": \"0.0000025\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"base_url": "https://contoso.openai.azure.com",
"declared_region": "us",
"declared_zdr": true,
"id": "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
"model_name": "OpenAI: GPT-4o",
"model_permaslug": "openai/gpt-4o-2024-08-06",
"model_slug": "openai/gpt-4o",
"pricing": {
"completion": "0.00001",
"prompt": "0.0000025"
},
"provider_name": "Azure",
"provider_slug": "azure",
"status": "active",
"upstream_model_id": "gpt-4o-prod"
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 408,
"message": "Operation timed out. Please try again later."
}
}{
"error": {
"code": 409,
"message": "Resource conflict. Please try again later."
}
}{
"error": {
"code": 422,
"message": "Invalid argument"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}Private Endpoints
Set private endpoint pricing
Set the negotiated per-token rates reported for requests routed to this endpoint. Applies to drafts and active endpoints; new rates take effect for subsequent requests. Management key required.
PUT
/
private-endpoints
/
{id}
/
pricing
Set private endpoint pricing
curl --request PUT \
--url https://openrouter.ai/api/v1/private-endpoints/{id}/pricing \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pricing": {
"completion": "0.00001",
"prompt": "0.0000025"
}
}
'import requests
url = "https://openrouter.ai/api/v1/private-endpoints/{id}/pricing"
payload = { "pricing": {
"completion": "0.00001",
"prompt": "0.0000025"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({pricing: {completion: '0.00001', prompt: '0.0000025'}})
};
fetch('https://openrouter.ai/api/v1/private-endpoints/{id}/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://openrouter.ai/api/v1/private-endpoints/{id}/pricing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'pricing' => [
'completion' => '0.00001',
'prompt' => '0.0000025'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/private-endpoints/{id}/pricing"
payload := strings.NewReader("{\n \"pricing\": {\n \"completion\": \"0.00001\",\n \"prompt\": \"0.0000025\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://openrouter.ai/api/v1/private-endpoints/{id}/pricing")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pricing\": {\n \"completion\": \"0.00001\",\n \"prompt\": \"0.0000025\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/private-endpoints/{id}/pricing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pricing\": {\n \"completion\": \"0.00001\",\n \"prompt\": \"0.0000025\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"base_url": "https://contoso.openai.azure.com",
"declared_region": "us",
"declared_zdr": true,
"id": "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
"model_name": "OpenAI: GPT-4o",
"model_permaslug": "openai/gpt-4o-2024-08-06",
"model_slug": "openai/gpt-4o",
"pricing": {
"completion": "0.00001",
"prompt": "0.0000025"
},
"provider_name": "Azure",
"provider_slug": "azure",
"status": "active",
"upstream_model_id": "gpt-4o-prod"
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 408,
"message": "Operation timed out. Please try again later."
}
}{
"error": {
"code": 409,
"message": "Resource conflict. Please try again later."
}
}{
"error": {
"code": 422,
"message": "Invalid argument"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}Authorizations
API key as bearer token in Authorization header
Path Parameters
Stable identifier of the private endpoint.
Example:
"5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11"
Body
application/json
Negotiated per-token rates reported for requests routed to this endpoint.
Show child attributes
Show child attributes
Example:
{
"completion": "0.00001",
"prompt": "0.0000025"
}
Response
The endpoint with its new pricing
Show child attributes
Show child attributes
Example:
{
"base_url": "https://contoso.openai.azure.com",
"declared_region": "us",
"declared_zdr": true,
"id": "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
"model_name": "OpenAI: GPT-4o",
"model_permaslug": "openai/gpt-4o-2024-08-06",
"model_slug": "openai/gpt-4o",
"pricing": {
"completion": "0.00001",
"prompt": "0.0000025"
},
"provider_name": "Azure",
"provider_slug": "azure",
"status": "active",
"upstream_model_id": "gpt-4o-prod"
}