Environments
The /environments
endpoint allows you to manage your Environments.
List Environments
Endpoint: /environments
Method: GET
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Query Parameters
Parameter | Data Type | Description |
---|---|---|
all | boolean | If true, list all environments, otherwise only the ones for the current project |
Example Request
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/environments?all=true' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
[
{
"id": "<ENVIRONMENT_ID>",
"name": "My OpenAI Environment",
"provider": "openai",
"created_at": "2023-10-26T15:23:04.443Z",
"updated_at": "2023-10-26T15:23:04.443Z",
"created_by": "user:<USER_ID>",
"updated_by": "user:<USER_ID>",
"account": "<ACCOUNT_ID>",
"allowed_projects": [
"<PROJECT_ID>"
]
}
]
Code Examples
List Environments
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/environments' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Create an Environment
Endpoint: /environments
Method: POST
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Input Parameters
Parameter | Data Type | Description |
---|---|---|
name | string | The name of the environment |
provider | SupportedProviders | The provider of the environment |
description | string | An optional description of the environment |
endpoint_url | string | The endpoint URL of the environment |
default_model | string | The default model for the environment |
apiKey | string | The API key for the environment |
config | object | The configuration for the environment |
allowed_projects | string[] | The projects that are allowed to use the environment |
Example Request
{
"name": "My OpenAI Environment",
"provider": "openai",
"description": "My OpenAI environment",
"endpoint_url": "https://api.openai.com/v1",
"default_model": "text-davinci-003",
"apiKey": "sk-...",
"config": {},
"allowed_projects": [
"<PROJECT_ID>"
]
}
Example Response
{
"id": "<ENVIRONMENT_ID>",
"name": "My OpenAI Environment",
"provider": "openai",
"description": "My OpenAI environment",
"endpoint_url": "https://api.openai.com/v1",
"default_model": "text-davinci-003",
"apiKey": "sk-************************",
"config": {},
"account": "<ACCOUNT_ID>",
"allowed_projects": [
"<PROJECT_ID>"
],
"created_by": "user:<USER_ID>",
"updated_by": "user:<USER_ID>",
"created_at": "2023-10-26T15:23:04.443Z",
"updated_at": "2023-10-26T15:23:04.443Z"
}
Code Examples
Create an Environment
curl --location --request POST 'https://studio-server-production.api.becomposable.com/api/v1/environments' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My OpenAI Environment",
"provider": "openai",
"description": "My OpenAI environment",
"endpoint_url": "https://api.openai.com/v1",
"default_model": "text-davinci-003",
"apiKey": "sk-...",
"config": {},
"allowed_projects": [
"<PROJECT_ID>"
]
}'
Retrieve an Environment
Endpoint: /environments/<ENVIRONMENT_ID>
Method: GET
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Description |
---|---|
<ENVIRONMENT_ID> | The ID of the environment to retrieve |
Example Request
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
{
"id": "<ENVIRONMENT_ID>",
"name": "My OpenAI Environment",
"provider": "openai",
"description": "My OpenAI environment",
"endpoint_url": "https://api.openai.com/v1",
"default_model": "text-davinci-003",
"apiKey": "sk-************************",
"config": {},
"account": "<ACCOUNT_ID>",
"allowed_projects": [
"<PROJECT_ID>"
],
"created_by": "user:<USER_ID>",
"updated_by": "user:<USER_ID>",
"created_at": "2023-10-26T15:23:04.443Z",
"updated_at": "2023-10-26T15:23:04.443Z"
}
Code Examples
Retrieve an Environment
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Update an Environment
Endpoint: /environments/<ENVIRONMENT_ID>
Method: PUT
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Description |
---|---|
<ENVIRONMENT_ID> | The ID of the environment to update |
Input Parameters
Parameter | Data Type | Description |
---|---|---|
name | string | The name of the environment |
provider | SupportedProviders | The provider of the environment |
description | string | An optional description of the environment |
endpoint_url | string | The endpoint URL of the environment |
default_model | string | The default model for the environment |
apiKey | string | The API key for the environment |
config | object | The configuration for the environment |
allowed_projects | string[] | The projects that are allowed to use the environment |
Example Request
{
"name": "My Updated OpenAI Environment",
"description": "My updated OpenAI environment"
}
Example Response
{
"id": "<ENVIRONMENT_ID>",
"name": "My Updated OpenAI Environment",
"provider": "openai",
"description": "My updated OpenAI environment",
"endpoint_url": "https://api.openai.com/v1",
"default_model": "text-davinci-003",
"apiKey": "sk-************************",
"config": {},
"account": "<ACCOUNT_ID>",
"allowed_projects": [
"<PROJECT_ID>"
],
"created_by": "user:<USER_ID>",
"updated_by": "user:<USER_ID>",
"created_at": "2023-10-26T15:23:04.443Z",
"updated_at": "2023-10-26T15:23:04.443Z"
}
Code Examples
Update an Environment
curl --location --request PUT 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My Updated OpenAI Environment",
"description": "My updated OpenAI environment"
}'
Delete an Environment
Endpoint: /environments/<ENVIRONMENT_ID>
Method: DELETE
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Description |
---|---|
<ENVIRONMENT_ID> | The ID of the environment to delete |
Example Request
curl --location --request DELETE 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
{
"id": "<ENVIRONMENT_ID>"
}
Code Examples
Delete an Environment
curl --location --request DELETE 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Get Available Models
Endpoint: /environments/<ENVIRONMENT_ID>/models
Method: GET
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Description |
---|---|
<ENVIRONMENT_ID> | The ID of the environment |
Query Parameters
Parameter | Data Type | Description |
---|---|---|
text | string | Text to search for in the model name or description |
type | string | The type of model to search for |
tags | string | The tags to search for in the model |
Example Request
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>/models?text=davinci' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
[
{
"id": "text-davinci-003",
"object": "model",
"created": 1678142652,
"owned_by": "openai",
"permission": [
{
"id": "modelperm-...",
"object": "model_permission",
"created": 1678142653,
"allow_create_engine": false,
"allow_sampling": true,
"allow_logprobs": true,
"allow_search_indices": false,
"allow_view": true,
"allow_fine_tuning": false,
"organization": "*",
"group": null,
"is_blocking": false
}
],
"root": "text-davinci-003",
"parent": null
}
]
Code Examples
Get Available Models
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>/models' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Generate Embeddings
Endpoint: /environments/<ENVIRONMENT_ID>/embeddings
Method: POST
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Description |
---|---|
<ENVIRONMENT_ID> | The ID of the environment |
Input Parameters
Parameter | Data Type | Description |
---|---|---|
text | string | The text to generate embeddings for |
image | string | The image to generate embeddings for |
Example Request
{
"text": "This is a test"
}
Example Response
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.0123123,
0.12312312,
...
],
"index": 0
}
],
"model": "text-embedding-ada-002",
"usage": {
"prompt_tokens": 4,
"total_tokens": 4
}
}
Code Examples
Generate Embeddings
curl --location --request POST 'https://studio-server-production.api.becomposable.com/api/v1/environments/<ENVIRONMENT_ID>/embeddings' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"text": "This is a test"
}'