curl --request PATCH \
--url https://openrouter.ai/api/v1/private-endpoints/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upstream_model_id": "gpt-4o-prod",
"base_url": "https://contoso.openai.azure.com",
"declared_region": "us",
"declared_zdr": true
}
'import requests
url = "https://openrouter.ai/api/v1/private-endpoints/{id}"
payload = {
"upstream_model_id": "gpt-4o-prod",
"base_url": "https://contoso.openai.azure.com",
"declared_region": "us",
"declared_zdr": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
upstream_model_id: 'gpt-4o-prod',
base_url: 'https://contoso.openai.azure.com',
declared_region: 'us',
declared_zdr: true
})
};
fetch('https://openrouter.ai/api/v1/private-endpoints/{id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'upstream_model_id' => 'gpt-4o-prod',
'base_url' => 'https://contoso.openai.azure.com',
'declared_region' => 'us',
'declared_zdr' => true
]),
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}"
payload := strings.NewReader("{\n \"upstream_model_id\": \"gpt-4o-prod\",\n \"base_url\": \"https://contoso.openai.azure.com\",\n \"declared_region\": \"us\",\n \"declared_zdr\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://openrouter.ai/api/v1/private-endpoints/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upstream_model_id\": \"gpt-4o-prod\",\n \"base_url\": \"https://contoso.openai.azure.com\",\n \"declared_region\": \"us\",\n \"declared_zdr\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/private-endpoints/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"upstream_model_id\": \"gpt-4o-prod\",\n \"base_url\": \"https://contoso.openai.azure.com\",\n \"declared_region\": \"us\",\n \"declared_zdr\": true\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"
}
}Update a draft private endpoint
Replace a draft endpoint’s upstream configuration: send upstream_model_id, and base_url to change it (an omitted base_url keeps the stored one). Omitted data-policy declarations are kept while the upstream is unchanged and cleared when it changes. Any change clears earlier validation. Active endpoints return 409; delete and re-create them instead. Management key required.
curl --request PATCH \
--url https://openrouter.ai/api/v1/private-endpoints/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upstream_model_id": "gpt-4o-prod",
"base_url": "https://contoso.openai.azure.com",
"declared_region": "us",
"declared_zdr": true
}
'import requests
url = "https://openrouter.ai/api/v1/private-endpoints/{id}"
payload = {
"upstream_model_id": "gpt-4o-prod",
"base_url": "https://contoso.openai.azure.com",
"declared_region": "us",
"declared_zdr": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
upstream_model_id: 'gpt-4o-prod',
base_url: 'https://contoso.openai.azure.com',
declared_region: 'us',
declared_zdr: true
})
};
fetch('https://openrouter.ai/api/v1/private-endpoints/{id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'upstream_model_id' => 'gpt-4o-prod',
'base_url' => 'https://contoso.openai.azure.com',
'declared_region' => 'us',
'declared_zdr' => true
]),
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}"
payload := strings.NewReader("{\n \"upstream_model_id\": \"gpt-4o-prod\",\n \"base_url\": \"https://contoso.openai.azure.com\",\n \"declared_region\": \"us\",\n \"declared_zdr\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://openrouter.ai/api/v1/private-endpoints/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upstream_model_id\": \"gpt-4o-prod\",\n \"base_url\": \"https://contoso.openai.azure.com\",\n \"declared_region\": \"us\",\n \"declared_zdr\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/private-endpoints/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"upstream_model_id\": \"gpt-4o-prod\",\n \"base_url\": \"https://contoso.openai.azure.com\",\n \"declared_region\": \"us\",\n \"declared_zdr\": true\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.
"5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11"
Body
Model or deployment identifier sent to the upstream provider.
1"gpt-4o-prod"
HTTPS base URL of your deployment. Required unless the provider derives its URL from the BYOK credential (Azure, Amazon Bedrock, Google Vertex).
1"https://contoso.openai.azure.com"
Attest where this deployment processes data.
global, europe, us, null "us"
Attest that this deployment retains no prompt or completion data.
Response
The updated endpoint
Show child attributes
Show child attributes
{
"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"
}