curl --request POST \
--url https://openrouter.ai/api/v1/workspaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"default_image_model": "openai/dall-e-3",
"default_provider_sort": "price",
"default_text_model": "openai/gpt-4o",
"description": "Production environment workspace",
"name": "Production",
"slug": "production"
}
'import requests
url = "https://openrouter.ai/api/v1/workspaces"
payload = {
"default_image_model": "openai/dall-e-3",
"default_provider_sort": "price",
"default_text_model": "openai/gpt-4o",
"description": "Production environment workspace",
"name": "Production",
"slug": "production"
}
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({
default_image_model: 'openai/dall-e-3',
default_provider_sort: 'price',
default_text_model: 'openai/gpt-4o',
description: 'Production environment workspace',
name: 'Production',
slug: 'production'
})
};
fetch('https://openrouter.ai/api/v1/workspaces', 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/workspaces",
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([
'default_image_model' => 'openai/dall-e-3',
'default_provider_sort' => 'price',
'default_text_model' => 'openai/gpt-4o',
'description' => 'Production environment workspace',
'name' => 'Production',
'slug' => 'production'
]),
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/workspaces"
payload := strings.NewReader("{\n \"default_image_model\": \"openai/dall-e-3\",\n \"default_provider_sort\": \"price\",\n \"default_text_model\": \"openai/gpt-4o\",\n \"description\": \"Production environment workspace\",\n \"name\": \"Production\",\n \"slug\": \"production\"\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://openrouter.ai/api/v1/workspaces")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"default_image_model\": \"openai/dall-e-3\",\n \"default_provider_sort\": \"price\",\n \"default_text_model\": \"openai/gpt-4o\",\n \"description\": \"Production environment workspace\",\n \"name\": \"Production\",\n \"slug\": \"production\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/workspaces")
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 \"default_image_model\": \"openai/dall-e-3\",\n \"default_provider_sort\": \"price\",\n \"default_text_model\": \"openai/gpt-4o\",\n \"description\": \"Production environment workspace\",\n \"name\": \"Production\",\n \"slug\": \"production\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"created_at": "2025-08-24T10:30:00Z",
"created_by": "user_abc123",
"default_image_model": "openai/dall-e-3",
"default_provider_sort": "price",
"default_text_model": "openai/gpt-4o",
"description": "Production environment workspace",
"id": "550e8400-e29b-41d4-a716-446655440000",
"io_logging_api_key_ids": null,
"io_logging_sampling_rate": 1,
"is_data_discount_logging_enabled": true,
"is_observability_broadcast_enabled": false,
"is_observability_io_logging_enabled": false,
"name": "Production",
"slug": "production",
"updated_at": null
}
}{
"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": 500,
"message": "Internal Server Error"
}
}Create a workspace
Create a new workspace for the authenticated user. Management key required.
curl --request POST \
--url https://openrouter.ai/api/v1/workspaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"default_image_model": "openai/dall-e-3",
"default_provider_sort": "price",
"default_text_model": "openai/gpt-4o",
"description": "Production environment workspace",
"name": "Production",
"slug": "production"
}
'import requests
url = "https://openrouter.ai/api/v1/workspaces"
payload = {
"default_image_model": "openai/dall-e-3",
"default_provider_sort": "price",
"default_text_model": "openai/gpt-4o",
"description": "Production environment workspace",
"name": "Production",
"slug": "production"
}
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({
default_image_model: 'openai/dall-e-3',
default_provider_sort: 'price',
default_text_model: 'openai/gpt-4o',
description: 'Production environment workspace',
name: 'Production',
slug: 'production'
})
};
fetch('https://openrouter.ai/api/v1/workspaces', 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/workspaces",
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([
'default_image_model' => 'openai/dall-e-3',
'default_provider_sort' => 'price',
'default_text_model' => 'openai/gpt-4o',
'description' => 'Production environment workspace',
'name' => 'Production',
'slug' => 'production'
]),
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/workspaces"
payload := strings.NewReader("{\n \"default_image_model\": \"openai/dall-e-3\",\n \"default_provider_sort\": \"price\",\n \"default_text_model\": \"openai/gpt-4o\",\n \"description\": \"Production environment workspace\",\n \"name\": \"Production\",\n \"slug\": \"production\"\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://openrouter.ai/api/v1/workspaces")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"default_image_model\": \"openai/dall-e-3\",\n \"default_provider_sort\": \"price\",\n \"default_text_model\": \"openai/gpt-4o\",\n \"description\": \"Production environment workspace\",\n \"name\": \"Production\",\n \"slug\": \"production\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/workspaces")
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 \"default_image_model\": \"openai/dall-e-3\",\n \"default_provider_sort\": \"price\",\n \"default_text_model\": \"openai/gpt-4o\",\n \"description\": \"Production environment workspace\",\n \"name\": \"Production\",\n \"slug\": \"production\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"created_at": "2025-08-24T10:30:00Z",
"created_by": "user_abc123",
"default_image_model": "openai/dall-e-3",
"default_provider_sort": "price",
"default_text_model": "openai/gpt-4o",
"description": "Production environment workspace",
"id": "550e8400-e29b-41d4-a716-446655440000",
"io_logging_api_key_ids": null,
"io_logging_sampling_rate": 1,
"is_data_discount_logging_enabled": true,
"is_observability_broadcast_enabled": false,
"is_observability_io_logging_enabled": false,
"name": "Production",
"slug": "production",
"updated_at": null
}
}{
"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": 500,
"message": "Internal Server Error"
}
}Authorizations
API key as bearer token in Authorization header
Body
Name for the new workspace
1 - 100"Production"
URL-friendly slug (lowercase alphanumeric segments separated by single hyphens, no leading/trailing hyphens)
1 - 50^[a-z0-9]+(?:-[a-z0-9]+)*$"production"
Default image model for this workspace
"openai/dall-e-3"
Default provider sort preference (price, throughput, latency, exacto)
"price"
Default text model for this workspace
"openai/gpt-4o"
Description of the workspace
500"Production environment workspace"
Optional array of API key IDs to filter I/O logging
null
Sampling rate for I/O logging (0.0001-1)
1
Whether data discount logging is enabled
true
Whether broadcast is enabled
false
Whether private logging is enabled
false
Response
Workspace created successfully
The created workspace
Show child attributes
Show child attributes
{ "created_at": "2025-08-24T10:30:00Z", "created_by": "user_abc123", "default_image_model": "openai/dall-e-3", "default_provider_sort": "price", "default_text_model": "openai/gpt-4o", "description": "Production environment workspace", "id": "550e8400-e29b-41d4-a716-446655440000", "io_logging_api_key_ids": null, "io_logging_sampling_rate": 1, "is_data_discount_logging_enabled": true, "is_observability_broadcast_enabled": false, "is_observability_io_logging_enabled": false, "name": "Production", "slug": "production", "updated_at": "2025-08-24T15:45:00Z" }