Containers
List containers
ContainerListPage containers().list(ContainerListParamsparams = ContainerListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /containers
List Containers
Parameters
-
ContainerListParams params-
Optional<String> afterA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<String> nameFilter results by container name.
-
Optional<Order> orderSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class ContainerListResponse:-
String idUnique identifier for the container.
-
long createdAtUnix timestamp (in seconds) when the container was created.
-
String nameName of the container.
-
String object_The type of this object.
-
String statusStatus of the container (e.g., active, deleted).
-
Optional<ExpiresAfter> expiresAfterThe container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.
-
Optional<Anchor> anchorThe reference point for the expiration.
LAST_ACTIVE_AT("last_active_at")
-
Optional<Long> minutesThe number of minutes after the anchor before the container expires.
-
-
Optional<Long> lastActiveAtUnix timestamp (in seconds) when the container was last active.
-
Optional<MemoryLimit> memoryLimitThe memory limit configured for the container.
-
_1G("1g") -
_4G("4g") -
_16G("16g") -
_64G("64g")
-
-
Optional<NetworkPolicy> networkPolicyNetwork access policy for the container.
-
Type typeThe network policy mode.
-
ALLOWLIST("allowlist") -
DISABLED("disabled")
-
-
Optional<List<String>> allowedDomainsAllowed outbound domains when
typeisallowlist.
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.ContainerListPage;
import com.openai.models.containers.ContainerListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ContainerListPage page = client.containers().list();
}
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "object",
"status": "status",
"expires_after": {
"anchor": "last_active_at",
"minutes": 0
},
"last_active_at": 0,
"memory_limit": "1g",
"network_policy": {
"type": "allowlist",
"allowed_domains": [
"string"
]
}
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Create container
ContainerCreateResponse containers().create(ContainerCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /containers
Create Container
Parameters
-
ContainerCreateParams params-
String nameName of the container to create.
-
Optional<ExpiresAfter> expiresAfterContainer expiration time in seconds relative to the 'anchor' time.
-
Anchor anchorTime anchor for the expiration time. Currently only 'last_active_at' is supported.
LAST_ACTIVE_AT("last_active_at")
-
long minutes
-
-
Optional<List<String>> fileIdsIDs of files to copy to the container.
-
Optional<MemoryLimit> memoryLimitOptional memory limit for the container. Defaults to "1g".
-
_1G("1g") -
_4G("4g") -
_16G("16g") -
_64G("64g")
-
-
Optional<NetworkPolicy> networkPolicyNetwork access policy for the container.
-
class ContainerNetworkPolicyDisabled:-
JsonValue; type "disabled"constantDisable outbound network access. Always
disabled.DISABLED("disabled")
-
-
class ContainerNetworkPolicyAllowlist:-
List<String> allowedDomainsA list of allowed domains when type is
allowlist. -
JsonValue; type "allowlist"constantAllow outbound network access only to specified domains. Always
allowlist.ALLOWLIST("allowlist")
-
Optional<List<ContainerNetworkPolicyDomainSecret>> domainSecretsOptional domain-scoped secrets for allowlisted domains.
-
String domainThe domain associated with the secret.
-
String nameThe name of the secret to inject for the domain.
-
String valueThe secret value to inject for the domain.
-
-
-
-
Optional<List<Skill>> skillsAn optional list of skills referenced by id or inline data.
-
class SkillReference:-
String skillIdThe ID of the referenced skill.
-
JsonValue; type "skill_reference"constantReferences a skill created with the /v1/skills endpoint.
SKILL_REFERENCE("skill_reference")
-
Optional<String> versionOptional skill version. Use a positive integer or 'latest'. Omit for default.
-
-
class InlineSkill:-
String descriptionThe description of the skill.
-
String nameThe name of the skill.
-
InlineSkillSource sourceInline skill payload
-
String dataBase64-encoded skill zip bundle.
-
JsonValue; mediaType "application/zip"constantThe media type of the inline skill payload. Must be
application/zip.APPLICATION_ZIP("application/zip")
-
JsonValue; type "base64"constantThe type of the inline skill source. Must be
base64.BASE64("base64")
-
-
JsonValue; type "inline"constantDefines an inline skill for this request.
INLINE("inline")
-
-
-
Returns
-
class ContainerCreateResponse:-
String idUnique identifier for the container.
-
long createdAtUnix timestamp (in seconds) when the container was created.
-
String nameName of the container.
-
String object_The type of this object.
-
String statusStatus of the container (e.g., active, deleted).
-
Optional<ExpiresAfter> expiresAfterThe container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.
-
Optional<Anchor> anchorThe reference point for the expiration.
LAST_ACTIVE_AT("last_active_at")
-
Optional<Long> minutesThe number of minutes after the anchor before the container expires.
-
-
Optional<Long> lastActiveAtUnix timestamp (in seconds) when the container was last active.
-
Optional<MemoryLimit> memoryLimitThe memory limit configured for the container.
-
_1G("1g") -
_4G("4g") -
_16G("16g") -
_64G("64g")
-
-
Optional<NetworkPolicy> networkPolicyNetwork access policy for the container.
-
Type typeThe network policy mode.
-
ALLOWLIST("allowlist") -
DISABLED("disabled")
-
-
Optional<List<String>> allowedDomainsAllowed outbound domains when
typeisallowlist.
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.ContainerCreateParams;
import com.openai.models.containers.ContainerCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ContainerCreateParams params = ContainerCreateParams.builder()
.name("name")
.build();
ContainerCreateResponse container = client.containers().create(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "object",
"status": "status",
"expires_after": {
"anchor": "last_active_at",
"minutes": 0
},
"last_active_at": 0,
"memory_limit": "1g",
"network_policy": {
"type": "allowlist",
"allowed_domains": [
"string"
]
}
}
Retrieve container
ContainerRetrieveResponse containers().retrieve(ContainerRetrieveParamsparams = ContainerRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /containers/{container_id}
Retrieve Container
Parameters
-
ContainerRetrieveParams paramsOptional<String> containerId
Returns
-
class ContainerRetrieveResponse:-
String idUnique identifier for the container.
-
long createdAtUnix timestamp (in seconds) when the container was created.
-
String nameName of the container.
-
String object_The type of this object.
-
String statusStatus of the container (e.g., active, deleted).
-
Optional<ExpiresAfter> expiresAfterThe container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.
-
Optional<Anchor> anchorThe reference point for the expiration.
LAST_ACTIVE_AT("last_active_at")
-
Optional<Long> minutesThe number of minutes after the anchor before the container expires.
-
-
Optional<Long> lastActiveAtUnix timestamp (in seconds) when the container was last active.
-
Optional<MemoryLimit> memoryLimitThe memory limit configured for the container.
-
_1G("1g") -
_4G("4g") -
_16G("16g") -
_64G("64g")
-
-
Optional<NetworkPolicy> networkPolicyNetwork access policy for the container.
-
Type typeThe network policy mode.
-
ALLOWLIST("allowlist") -
DISABLED("disabled")
-
-
Optional<List<String>> allowedDomainsAllowed outbound domains when
typeisallowlist.
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.ContainerRetrieveParams;
import com.openai.models.containers.ContainerRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ContainerRetrieveResponse container = client.containers().retrieve("container_id");
}
}
Response
{
"id": "id",
"created_at": 0,
"name": "name",
"object": "object",
"status": "status",
"expires_after": {
"anchor": "last_active_at",
"minutes": 0
},
"last_active_at": 0,
"memory_limit": "1g",
"network_policy": {
"type": "allowlist",
"allowed_domains": [
"string"
]
}
}
Delete a container
containers().delete(ContainerDeleteParamsparams = ContainerDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /containers/{container_id}
Delete Container
Parameters
-
ContainerDeleteParams paramsOptional<String> containerId
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.ContainerDeleteParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
client.containers().delete("container_id");
}
}
Files
List container files
FileListPage containers().files().list(FileListParamsparams = FileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /containers/{container_id}/files
List Container files
Parameters
-
FileListParams params-
Optional<String> containerId -
Optional<String> afterA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<Order> orderSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class FileListResponse:-
String idUnique identifier for the file.
-
long bytesSize of the file in bytes.
-
String containerIdThe container this file belongs to.
-
long createdAtUnix timestamp (in seconds) when the file was created.
-
JsonValue; object_ "container.file"constantThe type of this object (
container.file).CONTAINER_FILE("container.file")
-
String pathPath of the file in the container.
-
String sourceSource of the file (e.g.,
user,assistant).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.files.FileListPage;
import com.openai.models.containers.files.FileListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileListPage page = client.containers().files().list("container_id");
}
}
Response
{
"data": [
{
"id": "id",
"bytes": 0,
"container_id": "container_id",
"created_at": 0,
"object": "container.file",
"path": "path",
"source": "source"
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
Create container file
FileCreateResponse containers().files().create(FileCreateParamsparams = FileCreateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /containers/{container_id}/files
Create a Container File
You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.
Parameters
-
FileCreateParams params-
Optional<String> containerId -
Optional<String> fileThe File object (not file name) to be uploaded.
-
Optional<String> fileIdName of the file to create.
-
Returns
-
class FileCreateResponse:-
String idUnique identifier for the file.
-
long bytesSize of the file in bytes.
-
String containerIdThe container this file belongs to.
-
long createdAtUnix timestamp (in seconds) when the file was created.
-
JsonValue; object_ "container.file"constantThe type of this object (
container.file).CONTAINER_FILE("container.file")
-
String pathPath of the file in the container.
-
String sourceSource of the file (e.g.,
user,assistant).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.files.FileCreateParams;
import com.openai.models.containers.files.FileCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileCreateResponse file = client.containers().files().create("container_id");
}
}
Response
{
"id": "id",
"bytes": 0,
"container_id": "container_id",
"created_at": 0,
"object": "container.file",
"path": "path",
"source": "source"
}
Retrieve container file
FileRetrieveResponse containers().files().retrieve(FileRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /containers/{container_id}/files/{file_id}
Retrieve Container File
Parameters
-
FileRetrieveParams params-
String containerId -
Optional<String> fileId
-
Returns
-
class FileRetrieveResponse:-
String idUnique identifier for the file.
-
long bytesSize of the file in bytes.
-
String containerIdThe container this file belongs to.
-
long createdAtUnix timestamp (in seconds) when the file was created.
-
JsonValue; object_ "container.file"constantThe type of this object (
container.file).CONTAINER_FILE("container.file")
-
String pathPath of the file in the container.
-
String sourceSource of the file (e.g.,
user,assistant).
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.files.FileRetrieveParams;
import com.openai.models.containers.files.FileRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileRetrieveParams params = FileRetrieveParams.builder()
.containerId("container_id")
.fileId("file_id")
.build();
FileRetrieveResponse file = client.containers().files().retrieve(params);
}
}
Response
{
"id": "id",
"bytes": 0,
"container_id": "container_id",
"created_at": 0,
"object": "container.file",
"path": "path",
"source": "source"
}
Delete a container file
containers().files().delete(FileDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /containers/{container_id}/files/{file_id}
Delete Container File
Parameters
-
FileDeleteParams params-
String containerId -
Optional<String> fileId
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.files.FileDeleteParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileDeleteParams params = FileDeleteParams.builder()
.containerId("container_id")
.fileId("file_id")
.build();
client.containers().files().delete(params);
}
}
Content
Retrieve container file content
HttpResponse containers().files().content().retrieve(ContentRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /containers/{container_id}/files/{file_id}/content
Retrieve Container File Content
Parameters
-
ContentRetrieveParams params-
String containerId -
Optional<String> fileId
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.core.http.HttpResponse;
import com.openai.models.containers.files.content.ContentRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ContentRetrieveParams params = ContentRetrieveParams.builder()
.containerId("container_id")
.fileId("file_id")
.build();
HttpResponse content = client.containers().files().content().retrieve(params);
}
}