Update a private provider
curl --request PATCH \
--url https://openrouter.ai/api/v1/private-providers/{slug} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_url": "https://inference.example.com/v1",
"data_policy": {
"prompt_retention_days": 1825,
"retains_prompts": true,
"training": true
},
"display_name": "Acme"
}
'import requests
url = "https://openrouter.ai/api/v1/private-providers/{slug}"
payload = {
"base_url": "https://inference.example.com/v1",
"data_policy": {
"prompt_retention_days": 1825,
"retains_prompts": True,
"training": True
},
"display_name": "Acme"
}
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({
base_url: 'https://inference.example.com/v1',
data_policy: {prompt_retention_days: 1825, retains_prompts: true, training: true},
display_name: 'Acme'
})
};
fetch('https://openrouter.ai/api/v1/private-providers/{slug}', 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-providers/{slug}",
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([
'base_url' => 'https://inference.example.com/v1',
'data_policy' => [
'prompt_retention_days' => 1825,
'retains_prompts' => true,
'training' => true
],
'display_name' => 'Acme'
]),
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-providers/{slug}"
payload := strings.NewReader("{\n \"base_url\": \"https://inference.example.com/v1\",\n \"data_policy\": {\n \"prompt_retention_days\": 1825,\n \"retains_prompts\": true,\n \"training\": true\n },\n \"display_name\": \"Acme\"\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-providers/{slug}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_url\": \"https://inference.example.com/v1\",\n \"data_policy\": {\n \"prompt_retention_days\": 1825,\n \"retains_prompts\": true,\n \"training\": true\n },\n \"display_name\": \"Acme\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/private-providers/{slug}")
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 \"base_url\": \"https://inference.example.com/v1\",\n \"data_policy\": {\n \"prompt_retention_days\": 1825,\n \"retains_prompts\": true,\n \"training\": true\n },\n \"display_name\": \"Acme\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"base_url": "https://inference.example.com/v1",
"created_at": "2026-10-06T12:00:00.000Z",
"data_policy": {
"prompt_retention_days": null,
"retains_prompts": false,
"training": false
},
"display_name": "Acme",
"name": "Acme",
"slug": "acme"
}
}{
"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": 429,
"message": "Rate limit exceeded"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}Private Providers
Update a private provider
Update a private provider’s details or declared data policy. The name and slug cannot change. Refuses (409) a data-policy change while OpenRouter pins the declared policy on one of its endpoints. Management key required.
PATCH
/
private-providers
/
{slug}
Update a private provider
curl --request PATCH \
--url https://openrouter.ai/api/v1/private-providers/{slug} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_url": "https://inference.example.com/v1",
"data_policy": {
"prompt_retention_days": 1825,
"retains_prompts": true,
"training": true
},
"display_name": "Acme"
}
'import requests
url = "https://openrouter.ai/api/v1/private-providers/{slug}"
payload = {
"base_url": "https://inference.example.com/v1",
"data_policy": {
"prompt_retention_days": 1825,
"retains_prompts": True,
"training": True
},
"display_name": "Acme"
}
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({
base_url: 'https://inference.example.com/v1',
data_policy: {prompt_retention_days: 1825, retains_prompts: true, training: true},
display_name: 'Acme'
})
};
fetch('https://openrouter.ai/api/v1/private-providers/{slug}', 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-providers/{slug}",
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([
'base_url' => 'https://inference.example.com/v1',
'data_policy' => [
'prompt_retention_days' => 1825,
'retains_prompts' => true,
'training' => true
],
'display_name' => 'Acme'
]),
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-providers/{slug}"
payload := strings.NewReader("{\n \"base_url\": \"https://inference.example.com/v1\",\n \"data_policy\": {\n \"prompt_retention_days\": 1825,\n \"retains_prompts\": true,\n \"training\": true\n },\n \"display_name\": \"Acme\"\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-providers/{slug}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_url\": \"https://inference.example.com/v1\",\n \"data_policy\": {\n \"prompt_retention_days\": 1825,\n \"retains_prompts\": true,\n \"training\": true\n },\n \"display_name\": \"Acme\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/private-providers/{slug}")
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 \"base_url\": \"https://inference.example.com/v1\",\n \"data_policy\": {\n \"prompt_retention_days\": 1825,\n \"retains_prompts\": true,\n \"training\": true\n },\n \"display_name\": \"Acme\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"base_url": "https://inference.example.com/v1",
"created_at": "2026-10-06T12:00:00.000Z",
"data_policy": {
"prompt_retention_days": null,
"retains_prompts": false,
"training": false
},
"display_name": "Acme",
"name": "Acme",
"slug": "acme"
}
}{
"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": 429,
"message": "Rate limit exceeded"
}
}{
"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
Example:
"acme"
Body
application/json
HTTPS base URL of an OpenAI-compatible API, used by private endpoints under this provider that set no URL of their own. Without it, each endpoint must set its own. Private, internal, metadata and OpenRouter hosts are rejected.
Minimum string length:
1Example:
"https://inference.example.com/v1"
Show child attributes
Show child attributes
Required string length:
1 - 80Example:
"Acme"
Response
The updated provider
Show child attributes
Show child attributes
Example:
{
"base_url": "https://inference.example.com/v1",
"created_at": "2026-10-06T12:00:00.000Z",
"data_policy": {
"prompt_retention_days": null,
"retains_prompts": false,
"training": false
},
"display_name": "Acme",
"name": "Acme",
"slug": "acme"
}
Was this page helpful?