Files
wehub-resource-sync e0e362d700
Deploy Docs Pages / build (push) Waiting to run
Deploy Docs Pages / deploy (push) Blocked by required conditions
Real E2E Tests / Real E2E CI (push) Blocked by required conditions
SDK Tests / SDK CI (push) Blocked by required conditions
SDK Tests / changes (push) Successful in 2m29s
Real E2E Tests / changes (push) Successful in 2m29s
Real E2E Tests / Python E2E (docker bridge) (push) Waiting to run
Real E2E Tests / C# E2E (docker bridge) (push) Waiting to run
Real E2E Tests / Go E2E (docker bridge) (push) Waiting to run
Real E2E Tests / Java E2E (docker bridge) (push) Waiting to run
Real E2E Tests / JavaScript E2E (docker bridge) (push) Waiting to run
SDK Tests / Python SDK Tests (sandbox) (push) Waiting to run
SDK Tests / CLI Quality (push) Waiting to run
SDK Tests / CLI Tests (push) Waiting to run
SDK Tests / Python SDK Quality (code-interpreter) (push) Waiting to run
SDK Tests / Python SDK Quality (sandbox) (push) Waiting to run
SDK Tests / Python SDK Tests (code-interpreter) (push) Waiting to run
SDK Tests / JavaScript SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / JavaScript SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Kotlin SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Kotlin SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / C# SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / C# SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Go SDK Quality And Tests (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:39:33 +08:00

2.1 KiB

title, description
title description
Codex CLI Use the official @openai/codex npm package to call OpenAI/Codex-like models in OpenSandbox.

Codex/OpenAI CLI Example

Use the official @openai/codex npm package to call OpenAI/Codex-like models in OpenSandbox.

Start OpenSandbox server [local]

Pre-pull the code-interpreter image (includes Node.js):

docker pull sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.1.0

# use docker hub
# docker pull opensandbox/code-interpreter:v1.1.0

Start the local OpenSandbox server, logs will be visible in the terminal:

uv pip install opensandbox-server
opensandbox-server init-config ~/.sandbox.toml --example docker
opensandbox-server

Create and Access the Codex Sandbox

# Install OpenSandbox package
uv pip install opensandbox

# Run the example (requires SANDBOX_DOMAIN / SANDBOX_API_KEY / OPENAI_API_KEY)
uv run python examples/codex-cli/main.py

The script installs the Codex CLI (npm install -g @openai/codex@latest) at runtime (Node.js is already in the code-interpreter image), then executes a simple request codex exec "Compute 1+1 and return JSON with keys result and reasoning." --skip-git-repo-check. Auth is passed via OPENAI_API_KEY; you can override endpoint/model with OPENAI_BASE_URL / OPENAI_MODEL.

Environment Variables

Variable Default Description
SANDBOX_DOMAIN localhost:8080 Sandbox service address
SANDBOX_API_KEY (optional for local) API key if your server requires authentication
SANDBOX_IMAGE sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.1.0 Sandbox image to use
OPENAI_API_KEY (required) Your OpenAI API key
OPENAI_BASE_URL https://api.openai.com/v1 OpenAI API endpoint
OPENAI_MODEL gpt-4o-mini Model to use

References