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"
]
}
}