{"templateId":"markdown","sharedDataIds":{},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Codex Integration","description":"Treasure AI Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasure.ai","lang":"en-US","jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.treasure.ai/","name":"Treasure AI","url":"https://www.treasure.ai/","logo":"https://www.treasure.ai/hubfs/assets/images/logos/primary-logo.svg"},{"@type":"WebSite","@id":"https://docs.treasure.ai/#website","name":"Treasure AI Documentation","url":"https://docs.treasure.ai/","inLanguage":["en","ja"],"publisher":{"@id":"https://www.treasure.ai/"}}]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"codex-integration","__idx":0},"children":["Codex Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://chatgpt.com/codex"},"children":["OpenAI Codex"]}," — a coding assistant that lives in your terminal — with Treasure AI as the backend."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure AI customers can use Codex with their existing ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.treasuredata.com/terms/ai-suite-credits-definition/"},"children":["AI Suite credits"]}," — no separate OpenAI subscription required for TD-routed traffic."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Experimental"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx codex"]}," is an experimental integration. Behavior, flags, and defaults may change in future releases as the Codex CLI itself evolves."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"why-use-it","__idx":1},"children":["Why use it"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Code faster with AI in your terminal."]}," Ask questions, refactor code, generate tests, or write new features — all in plain English, right where you already work."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["One subscription for everything."]}," Reuse your Treasure AI account and ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.treasuredata.com/terms/ai-suite-credits-definition/"},"children":["AI Suite credits"]}," instead of paying for a separate OpenAI plan. Usage rolls up under your TD account, so billing and access control stay in one place."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Keeps your existing Codex setup intact."]}," If you already use Codex against OpenAI, that config is left completely alone. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx codex"]}," only wires up the Treasure AI provider for the session it launches."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Automatic sign-in."]}," Codex re-uses your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," login, so you don't manage a second set of API keys and tokens don't expire mid-session."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Works with your active profile."]}," Multi-account or multi-region users get routed to the right place based on the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," profile they've selected."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"what-it-helps-with","__idx":2},"children":["What it helps with"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once you launch Codex in a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]},"-managed project, you can ask it to help with the tasks ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," is built for:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Marketing as code"]}," — draft and edit ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/treasure-code/guide/marketing-as-code"},"children":["YAML definitions"]}," for parent segments, audiences, journeys, and campaigns, then have Codex run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," pull/push/validate for you."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Write SQL against your TD data"]}," — ask for a Trino query over your databases and tables, refine it in the terminal, and paste it into ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx query"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Author workflows"]}," — draft ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".dig"]}," workflow files that ingest data, transform tables, or trigger jobs on a schedule."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Define CDP journeys and audiences"]}," — describe the audience or realtime journey you want, and have Codex produce (or edit) the YAML that ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," will apply."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Explore and evolve an existing TD project"]}," — explain unfamiliar YAML, SQL, or workflow files, refactor them, add validation tests, and generate boilerplate for new segments or connections."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["It also works for anything Codex is normally good at — reading unfamiliar code, refactoring, generating tests, debugging errors, and writing small scripts."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"quick-start","__idx":3},"children":["Quick start"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You'll need a Treasure AI account with AI Suite access."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# 1. Install Codex (once per machine)\ncurl -fsSL https://chatgpt.com/codex/install.sh | sh\n\n# 2. Sign in to tdx (once per profile)\ntdx auth setup\n\n# 3. Launch Codex against Treasure AI\ntdx codex\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prefer a different Codex installer? ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["brew install --cask codex"]}," (macOS) and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npm install -g @openai/codex"]}," (any platform) also work — see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.openai.com/codex/"},"children":["Codex CLI docs"]}," for options."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":4},"children":["Examples"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Just launch Codex\ntdx codex\n\n# Start Codex with an initial prompt\ntdx codex -- \"Explain this code\"\n\n# Use a specific tdx profile — its region is used automatically\ntdx --profile production codex\n\n# Pick a model or pass any other Codex flag through\ntdx codex -- --model gpt-5.5 \"hello\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Anything after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--"]}," is passed to Codex unchanged, so any option supported by the Codex CLI is available."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example-prompts","__idx":5},"children":["Example prompts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once you're inside a Codex session, you can ask things like:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"> Add a workflow to periodically import data from S3 into mydb.orders\n\n> Write a SQL query to find the top customers by revenue in the last 30 days\n\n> Create a parent segment YAML for customers who purchased in the last 60 days\n\n> Add an audience under this parent segment for high-value customers with an email opt-in\n\n> Explain what this journey definition does, and add a stage for a re-engagement email\n\n> Refactor this workflow so the S3 import runs hourly instead of daily\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"options","__idx":6},"children":["Options"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx codex"]}," accepts the standard ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," global options — most usefully ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--profile <name>"]}," to pick which account and region to route through, and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--verbose"]}," to print the exact Codex command that gets launched. Everything after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--"]}," is passed to Codex unchanged."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"troubleshooting","__idx":7},"children":["Troubleshooting"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Codex says it can't find the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," command."]}," ","Make sure ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," is installed globally and on your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PATH"]}," (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npm install -g @treasuredata/tdx"]},"), then rerun ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx codex"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Codex authentication fails after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx codex"]}," starts."]}," ","Check your sign-in with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx status"]}," — it shows whether the active profile is authenticated. If not, run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx auth setup"]}," to sign in again, then relaunch Codex."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Codex seems to be using the wrong account or region."]}," ","The active profile is captured when Codex launches, so switching profiles in another shell doesn't retarget an already-running Codex. Quit Codex and relaunch it with the profile you want: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx --profile <name> codex"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"learn-more","__idx":8},"children":["Learn More"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.openai.com/codex/"},"children":["Codex CLI Documentation"]}," — upstream CLI documentation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/ja/treasure-code/commands/claude"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx claude"]}]}," — the equivalent launcher for Claude Code"]}]}]},"headings":[{"value":"Codex Integration","id":"codex-integration","depth":1},{"value":"Why use it","id":"why-use-it","depth":2},{"value":"What it helps with","id":"what-it-helps-with","depth":2},{"value":"Quick start","id":"quick-start","depth":2},{"value":"Examples","id":"examples","depth":2},{"value":"Example prompts","id":"example-prompts","depth":2},{"value":"Options","id":"options","depth":2},{"value":"Troubleshooting","id":"troubleshooting","depth":2},{"value":"Learn More","id":"learn-more","depth":2}],"frontmatter":{"seo":{"title":"Codex Integration"}},"lastModified":"2026-08-28T00:47:39.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/treasure-code/commands/codex","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}