curl --request POST \
--url https://cloud-api.near.ai/v1/admin/models/deprecate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"modelId": "<string>",
"successorModelId": "<string>",
"changeReason": "<string>"
}
'import requests
url = "https://cloud-api.near.ai/v1/admin/models/deprecate"
payload = {
"modelId": "<string>",
"successorModelId": "<string>",
"changeReason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({modelId: '<string>', successorModelId: '<string>', changeReason: '<string>'})
};
fetch('https://cloud-api.near.ai/v1/admin/models/deprecate', 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://cloud-api.near.ai/v1/admin/models/deprecate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'modelId' => '<string>',
'successorModelId' => '<string>',
'changeReason' => '<string>'
]),
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://cloud-api.near.ai/v1/admin/models/deprecate"
payload := strings.NewReader("{\n \"modelId\": \"<string>\",\n \"successorModelId\": \"<string>\",\n \"changeReason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://cloud-api.near.ai/v1/admin/models/deprecate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"modelId\": \"<string>\",\n \"successorModelId\": \"<string>\",\n \"changeReason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/admin/models/deprecate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"modelId\": \"<string>\",\n \"successorModelId\": \"<string>\",\n \"changeReason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"aliasesCarried": 1,
"deprecated": {
"costPerImage": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"inputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"metadata": {
"attestationSupported": true,
"contextLength": 123,
"modelDescription": "<string>",
"modelDisplayName": "<string>",
"ownedBy": "<string>",
"providerType": "<string>",
"verifiable": true,
"aliases": [
"<string>"
],
"architecture": {
"inputModalities": [
"<string>"
],
"outputModalities": [
"<string>"
]
},
"datacenters": [
{
"country_code": "<string>"
}
],
"deprecationDate": "<string>",
"huggingFaceId": "<string>",
"inferenceUrl": "<string>",
"isReady": true,
"maxOutputLength": 123,
"modelIcon": "<string>",
"openrouterSlug": "<string>",
"providerConfig": "<unknown>",
"quantization": "<string>",
"supportedFeatures": [
"<string>"
],
"supportedSamplingParameters": [
"<string>"
]
},
"modelId": "<string>",
"outputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"cacheReadCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
}
},
"successor": {
"costPerImage": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"inputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"metadata": {
"attestationSupported": true,
"contextLength": 123,
"modelDescription": "<string>",
"modelDisplayName": "<string>",
"ownedBy": "<string>",
"providerType": "<string>",
"verifiable": true,
"aliases": [
"<string>"
],
"architecture": {
"inputModalities": [
"<string>"
],
"outputModalities": [
"<string>"
]
},
"datacenters": [
{
"country_code": "<string>"
}
],
"deprecationDate": "<string>",
"huggingFaceId": "<string>",
"inferenceUrl": "<string>",
"isReady": true,
"maxOutputLength": 123,
"modelIcon": "<string>",
"openrouterSlug": "<string>",
"providerConfig": "<unknown>",
"quantization": "<string>",
"supportedFeatures": [
"<string>"
],
"supportedSamplingParameters": [
"<string>"
]
},
"modelId": "<string>",
"outputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"cacheReadCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Deprecate a model in favor of another (Admin only)
Atomically marks modelId as deprecated and routes its traffic to
successorModelId:
- Adds
modelIdas an alias ofsuccessorModelId, so existing clients sendingmodel: "<modelId>"keep working — the alias resolver rewrites the request-sidemodelfield to the successor before backend dispatch, and the response’smodelfield reflects the canonical (successor) name. - Re-points any pre-existing inbound aliases of
modelIdat the successor, so historical aliases keep resolving. - Sets
modelId.isActive = falseso it is hidden from publicGET /v1/modelsand fromGET /v1/admin/modelsunlessinclude_inactive=true. - Records a
model_historyentry for audit purposes.
All steps run in a single DB transaction. If the successor is inactive or either model is missing, returns 404 without modifying state.
curl --request POST \
--url https://cloud-api.near.ai/v1/admin/models/deprecate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"modelId": "<string>",
"successorModelId": "<string>",
"changeReason": "<string>"
}
'import requests
url = "https://cloud-api.near.ai/v1/admin/models/deprecate"
payload = {
"modelId": "<string>",
"successorModelId": "<string>",
"changeReason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({modelId: '<string>', successorModelId: '<string>', changeReason: '<string>'})
};
fetch('https://cloud-api.near.ai/v1/admin/models/deprecate', 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://cloud-api.near.ai/v1/admin/models/deprecate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'modelId' => '<string>',
'successorModelId' => '<string>',
'changeReason' => '<string>'
]),
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://cloud-api.near.ai/v1/admin/models/deprecate"
payload := strings.NewReader("{\n \"modelId\": \"<string>\",\n \"successorModelId\": \"<string>\",\n \"changeReason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://cloud-api.near.ai/v1/admin/models/deprecate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"modelId\": \"<string>\",\n \"successorModelId\": \"<string>\",\n \"changeReason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/admin/models/deprecate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"modelId\": \"<string>\",\n \"successorModelId\": \"<string>\",\n \"changeReason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"aliasesCarried": 1,
"deprecated": {
"costPerImage": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"inputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"metadata": {
"attestationSupported": true,
"contextLength": 123,
"modelDescription": "<string>",
"modelDisplayName": "<string>",
"ownedBy": "<string>",
"providerType": "<string>",
"verifiable": true,
"aliases": [
"<string>"
],
"architecture": {
"inputModalities": [
"<string>"
],
"outputModalities": [
"<string>"
]
},
"datacenters": [
{
"country_code": "<string>"
}
],
"deprecationDate": "<string>",
"huggingFaceId": "<string>",
"inferenceUrl": "<string>",
"isReady": true,
"maxOutputLength": 123,
"modelIcon": "<string>",
"openrouterSlug": "<string>",
"providerConfig": "<unknown>",
"quantization": "<string>",
"supportedFeatures": [
"<string>"
],
"supportedSamplingParameters": [
"<string>"
]
},
"modelId": "<string>",
"outputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"cacheReadCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
}
},
"successor": {
"costPerImage": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"inputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"metadata": {
"attestationSupported": true,
"contextLength": 123,
"modelDescription": "<string>",
"modelDisplayName": "<string>",
"ownedBy": "<string>",
"providerType": "<string>",
"verifiable": true,
"aliases": [
"<string>"
],
"architecture": {
"inputModalities": [
"<string>"
],
"outputModalities": [
"<string>"
]
},
"datacenters": [
{
"country_code": "<string>"
}
],
"deprecationDate": "<string>",
"huggingFaceId": "<string>",
"inferenceUrl": "<string>",
"isReady": true,
"maxOutputLength": 123,
"modelIcon": "<string>",
"openrouterSlug": "<string>",
"providerConfig": "<unknown>",
"quantization": "<string>",
"supportedFeatures": [
"<string>"
],
"supportedSamplingParameters": [
"<string>"
]
},
"modelId": "<string>",
"outputCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
},
"cacheReadCostPerToken": {
"amount": 123,
"currency": "<string>",
"scale": 123
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
JWT access token for user authentication (Authorization: Bearer <jwt_token>). Create via POST /users/me/access_tokens.
Body
Request to deprecate one model in favor of another.
Atomically:
- adds
modelIdas an alias ofsuccessorModelId(so existing clients continue to work, with their request-sidemodelrewritten to the successor at resolution time), - re-points any existing inbound aliases of
modelIdat the successor, - sets
modelId.isActive = falseso it is hidden fromGET /v1/modelsandGET /v1/admin/models(unlessinclude_inactiveis set).
Response
Model deprecated successfully
Response from a deprecation operation.
Both sides use the public ModelWithPricing shape (no isActive /
timestamps). Confirmation that the deprecation took effect is implicit:
the deprecated model is hidden from GET /v1/admin/models (default
listing) and from public GET /v1/models. To inspect isActive
directly, call GET /v1/admin/models?include_inactive=true.
Number of pre-existing active inbound aliases of the deprecated model that were re-pointed at the successor. Does not include the deprecated model's own canonical name (which is added unconditionally as a new alias) and does not include inactive inbound aliases (which are left untouched — see repository docs).
x >= 0State of the deprecated model after the operation (canonical name
echoed back in modelId; merged alias list reflects the moves).
Show child attributes
Show child attributes
State of the successor model after the operation. Its metadata.aliases
includes the deprecated modelId plus any inbound aliases that were
re-pointed.
Show child attributes
Show child attributes