Create gateway
curl --request POST \
--url https://api.coreweave.com/v1alpha1/inference/gateways \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"id": "<string>",
"zones": [
"<string>"
],
"coreWeaveAuth": {
"organizations": [
"<string>"
]
},
"weightsAndBiasesAuth": {
"apiKey": "<string>",
"serverUrl": "<string>",
"enableUsageReports": true,
"enableRateLimiting": true
},
"endpointConfiguration": {
"additionalDns": [
"<string>"
],
"allowedSourceIpRanges": [
"<string>"
]
},
"pathBasedRouting": {}
}
'import requests
url = "https://api.coreweave.com/v1alpha1/inference/gateways"
payload = {
"name": "<string>",
"id": "<string>",
"zones": ["<string>"],
"coreWeaveAuth": { "organizations": ["<string>"] },
"weightsAndBiasesAuth": {
"apiKey": "<string>",
"serverUrl": "<string>",
"enableUsageReports": True,
"enableRateLimiting": True
},
"endpointConfiguration": {
"additionalDns": ["<string>"],
"allowedSourceIpRanges": ["<string>"]
},
"pathBasedRouting": {}
}
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({
name: '<string>',
id: '<string>',
zones: ['<string>'],
coreWeaveAuth: {organizations: ['<string>']},
weightsAndBiasesAuth: {
apiKey: '<string>',
serverUrl: '<string>',
enableUsageReports: true,
enableRateLimiting: true
},
endpointConfiguration: {additionalDns: ['<string>'], allowedSourceIpRanges: ['<string>']},
pathBasedRouting: {}
})
};
fetch('https://api.coreweave.com/v1alpha1/inference/gateways', 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.coreweave.com/v1alpha1/inference/gateways",
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([
'name' => '<string>',
'id' => '<string>',
'zones' => [
'<string>'
],
'coreWeaveAuth' => [
'organizations' => [
'<string>'
]
],
'weightsAndBiasesAuth' => [
'apiKey' => '<string>',
'serverUrl' => '<string>',
'enableUsageReports' => true,
'enableRateLimiting' => true
],
'endpointConfiguration' => [
'additionalDns' => [
'<string>'
],
'allowedSourceIpRanges' => [
'<string>'
]
],
'pathBasedRouting' => [
]
]),
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://api.coreweave.com/v1alpha1/inference/gateways"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"zones\": [\n \"<string>\"\n ],\n \"coreWeaveAuth\": {\n \"organizations\": [\n \"<string>\"\n ]\n },\n \"weightsAndBiasesAuth\": {\n \"apiKey\": \"<string>\",\n \"serverUrl\": \"<string>\",\n \"enableUsageReports\": true,\n \"enableRateLimiting\": true\n },\n \"endpointConfiguration\": {\n \"additionalDns\": [\n \"<string>\"\n ],\n \"allowedSourceIpRanges\": [\n \"<string>\"\n ]\n },\n \"pathBasedRouting\": {}\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://api.coreweave.com/v1alpha1/inference/gateways")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"zones\": [\n \"<string>\"\n ],\n \"coreWeaveAuth\": {\n \"organizations\": [\n \"<string>\"\n ]\n },\n \"weightsAndBiasesAuth\": {\n \"apiKey\": \"<string>\",\n \"serverUrl\": \"<string>\",\n \"enableUsageReports\": true,\n \"enableRateLimiting\": true\n },\n \"endpointConfiguration\": {\n \"additionalDns\": [\n \"<string>\"\n ],\n \"allowedSourceIpRanges\": [\n \"<string>\"\n ]\n },\n \"pathBasedRouting\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coreweave.com/v1alpha1/inference/gateways")
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 \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"zones\": [\n \"<string>\"\n ],\n \"coreWeaveAuth\": {\n \"organizations\": [\n \"<string>\"\n ]\n },\n \"weightsAndBiasesAuth\": {\n \"apiKey\": \"<string>\",\n \"serverUrl\": \"<string>\",\n \"enableUsageReports\": true,\n \"enableRateLimiting\": true\n },\n \"endpointConfiguration\": {\n \"additionalDns\": [\n \"<string>\"\n ],\n \"allowedSourceIpRanges\": [\n \"<string>\"\n ]\n },\n \"pathBasedRouting\": {}\n}"
response = http.request(request)
puts response.read_body{
"gateway": {
"spec": {
"id": "<string>",
"name": "<string>",
"zones": [
"<string>"
],
"coreWeaveAuth": {
"organizations": [
"<string>"
]
},
"weightsAndBiasesAuth": {
"apiKey": "<string>",
"serverUrl": "<string>",
"enableUsageReports": true,
"enableRateLimiting": true
},
"organizationId": "<string>",
"endpointConfiguration": {
"additionalDns": [
"<string>"
],
"edgeProxyMode": "EDGE_PROXY_MODE_UNSPECIFIED",
"allowedSourceIpRanges": [
"<string>"
]
},
"bodyBasedRouting": {
"apiType": "API_TYPE_OPENAI"
},
"headerBasedRouting": {
"headerName": "<string>"
},
"pathBasedRouting": {}
},
"status": {
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"status": "STATUS_UNSPECIFIED",
"conditions": [
{
"type": "<string>",
"status": "STATUS_UNSPECIFIED",
"lastUpdateTime": "2023-11-07T05:31:56Z",
"reason": "<string>",
"message": "<string>",
"zone": "<string>"
}
],
"endpoints": [
"<string>"
]
}
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Create gateway
Create a CoreWeave inference gateway with one authentication type and one routing strategy.
POST
/
v1alpha1
/
inference
/
gateways
Create gateway
curl --request POST \
--url https://api.coreweave.com/v1alpha1/inference/gateways \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"id": "<string>",
"zones": [
"<string>"
],
"coreWeaveAuth": {
"organizations": [
"<string>"
]
},
"weightsAndBiasesAuth": {
"apiKey": "<string>",
"serverUrl": "<string>",
"enableUsageReports": true,
"enableRateLimiting": true
},
"endpointConfiguration": {
"additionalDns": [
"<string>"
],
"allowedSourceIpRanges": [
"<string>"
]
},
"pathBasedRouting": {}
}
'import requests
url = "https://api.coreweave.com/v1alpha1/inference/gateways"
payload = {
"name": "<string>",
"id": "<string>",
"zones": ["<string>"],
"coreWeaveAuth": { "organizations": ["<string>"] },
"weightsAndBiasesAuth": {
"apiKey": "<string>",
"serverUrl": "<string>",
"enableUsageReports": True,
"enableRateLimiting": True
},
"endpointConfiguration": {
"additionalDns": ["<string>"],
"allowedSourceIpRanges": ["<string>"]
},
"pathBasedRouting": {}
}
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({
name: '<string>',
id: '<string>',
zones: ['<string>'],
coreWeaveAuth: {organizations: ['<string>']},
weightsAndBiasesAuth: {
apiKey: '<string>',
serverUrl: '<string>',
enableUsageReports: true,
enableRateLimiting: true
},
endpointConfiguration: {additionalDns: ['<string>'], allowedSourceIpRanges: ['<string>']},
pathBasedRouting: {}
})
};
fetch('https://api.coreweave.com/v1alpha1/inference/gateways', 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.coreweave.com/v1alpha1/inference/gateways",
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([
'name' => '<string>',
'id' => '<string>',
'zones' => [
'<string>'
],
'coreWeaveAuth' => [
'organizations' => [
'<string>'
]
],
'weightsAndBiasesAuth' => [
'apiKey' => '<string>',
'serverUrl' => '<string>',
'enableUsageReports' => true,
'enableRateLimiting' => true
],
'endpointConfiguration' => [
'additionalDns' => [
'<string>'
],
'allowedSourceIpRanges' => [
'<string>'
]
],
'pathBasedRouting' => [
]
]),
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://api.coreweave.com/v1alpha1/inference/gateways"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"zones\": [\n \"<string>\"\n ],\n \"coreWeaveAuth\": {\n \"organizations\": [\n \"<string>\"\n ]\n },\n \"weightsAndBiasesAuth\": {\n \"apiKey\": \"<string>\",\n \"serverUrl\": \"<string>\",\n \"enableUsageReports\": true,\n \"enableRateLimiting\": true\n },\n \"endpointConfiguration\": {\n \"additionalDns\": [\n \"<string>\"\n ],\n \"allowedSourceIpRanges\": [\n \"<string>\"\n ]\n },\n \"pathBasedRouting\": {}\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://api.coreweave.com/v1alpha1/inference/gateways")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"zones\": [\n \"<string>\"\n ],\n \"coreWeaveAuth\": {\n \"organizations\": [\n \"<string>\"\n ]\n },\n \"weightsAndBiasesAuth\": {\n \"apiKey\": \"<string>\",\n \"serverUrl\": \"<string>\",\n \"enableUsageReports\": true,\n \"enableRateLimiting\": true\n },\n \"endpointConfiguration\": {\n \"additionalDns\": [\n \"<string>\"\n ],\n \"allowedSourceIpRanges\": [\n \"<string>\"\n ]\n },\n \"pathBasedRouting\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coreweave.com/v1alpha1/inference/gateways")
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 \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"zones\": [\n \"<string>\"\n ],\n \"coreWeaveAuth\": {\n \"organizations\": [\n \"<string>\"\n ]\n },\n \"weightsAndBiasesAuth\": {\n \"apiKey\": \"<string>\",\n \"serverUrl\": \"<string>\",\n \"enableUsageReports\": true,\n \"enableRateLimiting\": true\n },\n \"endpointConfiguration\": {\n \"additionalDns\": [\n \"<string>\"\n ],\n \"allowedSourceIpRanges\": [\n \"<string>\"\n ]\n },\n \"pathBasedRouting\": {}\n}"
response = http.request(request)
puts response.read_body{
"gateway": {
"spec": {
"id": "<string>",
"name": "<string>",
"zones": [
"<string>"
],
"coreWeaveAuth": {
"organizations": [
"<string>"
]
},
"weightsAndBiasesAuth": {
"apiKey": "<string>",
"serverUrl": "<string>",
"enableUsageReports": true,
"enableRateLimiting": true
},
"organizationId": "<string>",
"endpointConfiguration": {
"additionalDns": [
"<string>"
],
"edgeProxyMode": "EDGE_PROXY_MODE_UNSPECIFIED",
"allowedSourceIpRanges": [
"<string>"
]
},
"bodyBasedRouting": {
"apiType": "API_TYPE_OPENAI"
},
"headerBasedRouting": {
"headerName": "<string>"
},
"pathBasedRouting": {}
},
"status": {
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"status": "STATUS_UNSPECIFIED",
"conditions": [
{
"type": "<string>",
"status": "STATUS_UNSPECIFIED",
"lastUpdateTime": "2023-11-07T05:31:56Z",
"reason": "<string>",
"message": "<string>",
"zone": "<string>"
}
],
"endpoints": [
"<string>"
]
}
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}- The API server is
https://api.coreweave.com. - Replace
{API_ACCESS_TOKEN}with your CoreWeave API access token. - For required permissions, see IAM Access Policies.
coreWeaveAuth or weightsAndBiasesAuth)
and exactly one routing strategy (bodyBasedRouting,
headerBasedRouting, or pathBasedRouting). The available
zones for zones are returned by
GET /v1alpha1/inference/gateways/parameters.
Example request
curl -X POST https://api.coreweave.com/v1alpha1/inference/gateways \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {API_ACCESS_TOKEN}" \
-d @data.json
Authentication
coreWeaveAuth: validate inference requests using the same CoreWeave API access tokens used to call the management API. No additional configuration is required.weightsAndBiasesAuth: validate inference requests using Weights & Biases SaaS credentials. Optional fields includeenableUsageReportsandenableRateLimiting. W&B self-hosted is not currently supported.
Routing strategies
bodyBasedRouting: the model name is read from themodelfield in the JSON request body. SetapiType: API_TYPE_OPENAIfor OpenAI-compatible behavior.pathBasedRouting: the model name is the first segment of the URL path. URL-encode model names that contain special characters.headerBasedRouting: the model name is read from a custom HTTP header you specify inheaderName(1-100 characters).
Authorizations
Body
application/json
Request for CreateGateway
Was this page helpful?