OpenAI API and Codex Documentation
website·Indexed 34 days ago
https://docs.datacoves.comDocumentation for OpenAI models including GPT-4o, o1, and o3 series, as well as the Codex CLI. Covers authentication, model IDs, and developer commands for managing interactive sessions and debugging.
What's inside OpenAI
- Airflow variables are key-value pairs used to store instance-level information that rarely changes, such as API keys or configuration file paths. They support two types: regular values and JSON serialized values. Variables are encrypted with Fernet when stored in the Airflow metastore. To mask sensitive values in the UI and logs, include a substring indicating a sensitive value in the variable name.
Overview of Snowflake Key-Pair Authentication
Key-pair authentication is a secure alternative to basic username/password authentication in Snowflake. It requires a minimum 2048-bit RSA key pair. The public key is assigned to the Snowflake user, while the private key is stored locally by the client. Snowflake also supports rotating public keys to meet security and governance requirements.Overview of IAM Roles for Service Accounts (IRSA)
IAM Roles for Service Accounts (IRSA) allows you to associate an IAM role with a Kubernetes service account. Pods configured to use that service account can then make AWS API requests using the permissions defined in the IAM role. This replaces the need to distribute static AWS credentials to containers or rely on the Amazon EC2 instance profile (node role).
Key benefits include:
- Least Privilege: Permissions are scoped to specific service accounts rather than the entire node.
- Credential Isolation: Pods can only retrieve credentials for their assigned role, preventing access to other Pods' credentials (provided IMDS access is restricted).
- Auditability: All requests are logged via AWS CloudTrail.
Constraints: IRSA cannot be used with local clusters for Amazon EKS on AWS Outposts.
Understand AWS Global Infrastructure components for EC2
Amazon EC2 is hosted across several infrastructure types to provide varying levels of isolation, latency, and proximity:
- Regions: Separate geographic areas. Each Region is isolated from others to ensure fault tolerance and stability.
- Availability Zones (AZs): Multiple, isolated locations within a single Region.
- Local Zones: Extensions of a Region located closer to end users to provide low-latency compute and storage.
- Wavelength Zones: AWS services deployed at the edge of 5G networks for ultra-low latency to mobile devices.
- AWS Outposts: Native AWS services and infrastructure deployed on-premises or in third-party colocation spaces.
Retrieve Airflow variables in a DAG
There are three primary ways to retrieve variables, each with different performance and security trade-offs:
Variable.get(): The most secure method for secrets, but causes performance hits if used in top-level DAG code (hits the metadata DB on every parse).- Jinja Template: The recommended way to avoid performance issues; evaluated only at runtime.
os.getenv(): The fastest method as it avoids DB requests, but less secure for secrets as they may be printed to logs.
# Method 1: Python API from airflow.sdk import Variable val = Variable.get('my_var', 'default_value') # Method 2: Jinja Template (used in operator arguments) # {{ var.value.get('my_var', 'default_value') }} # Method 3: Environment Variable import os val = os.getenv('AIRFLOW_VAR_my_var', 'default_value')Manage Codex plugins and marketplaces
Use
codex pluginto install, list, and remove plugins. Usecodex plugin marketplaceto manage the sources Codex uses to browse and install plugins.- Marketplace Sources:
codex plugin marketplace addsupports GitHub shorthand (owner/repoorowner/repo@ref), Git URLs (HTTP/HTTPS/SSH), and local directories. Use--refto pin a Git ref and--sparse PATHfor sparse checkouts. - Automation: Add the
--jsonflag toadd,list,upgrade, orremovecommands to get machine-readable output.
# Add a marketplace source codex plugin marketplace add owner/repo --ref main # List plugins in JSON format codex plugin list --json- Marketplace Sources:
Run the Claude Code CLI within VS Code
To use the CLI in VS Code, open the integrated terminal (
Ctrl+`orCmd+`) and runclaude.Key Integration Details:
- Installation: Requires a standalone CLI install; the extension's bundled version is private and not added to the PATH.
- External Terminals: If using a terminal outside of VS Code, run
/ideinside the CLI to connect it to the editor. - Resuming Sessions: To continue a conversation started in the extension within the CLI, run
claude --resumeto open the conversation picker.
claude --resumeAuthenticate Codex CLI on headless or remote devices
When browser-based login is unavailable (e.g., remote SSH or blocked localhost callbacks), use one of these three methods:
- Device Code Authentication (Beta): The preferred method. Requires enabling device code login in ChatGPT security/workspace settings.
- Auth Cache Transfer: Perform
codex loginon a local machine and copy the resulting~/.codex/auth.jsonfile to the remote machine. - SSH Port Forwarding: Tunnel the localhost callback server (default port 1455) from the remote host to your local machine.
# Method 1: Device Code codex login --device-auth # Method 2: Copy auth.json via SSH ssh user@remote 'mkdir -p ~/.codex' scp ~/.codex/auth.json user@remote:~/.codex/auth.json # Method 2: Copy auth.json into Docker CONTAINER_HOME=$(docker exec MY_CONTAINER printenv HOME) docker exec MY_CONTAINER mkdir -p "$CONTAINER_HOME/.codex" docker cp ~/.codex/auth.json MY_CONTAINER:"$CONTAINER_HOME/.codex/auth.json" # Method 3: Port Forwarding ssh -L 1455:localhost:1455 user@remote # Then run 'codex login' inside that sessionRotate public keys using RSA_PUBLIC_KEY properties
If using the
RSA_PUBLIC_KEYproperty instead of named key pairs, you can rotate keys by utilizing the second available slot (RSA_PUBLIC_KEY_2).- Assign the new public key to the unused property (
RSA_PUBLIC_KEYorRSA_PUBLIC_KEY_2). - Update your client code to use the new private key.
- Remove the old public key using the
UNSETcommand.
-- 1. Assign new key to the second slot ALTER USER example_user SET RSA_PUBLIC_KEY_2='JERUEHtcve...'; -- 3. Remove the old key ALTER USER example_user UNSET RSA_PUBLIC_KEY;- Assign the new public key to the unused property (
Best practices for using Airflow Variables
To maintain performance and security in Airflow, follow these guidelines:
- Use variables for runtime-dependent information that changes infrequently.
- Avoid top-level DAG code: Do not call variables outside of tasks in the DAG file, as this creates a connection to the metastore every time the DAG is parsed.
- Use Jinja Templates: If a variable is needed in the DAG definition, use Jinja template syntax so it is only rendered during task execution.
- Choose the right storage:
- Use Environment Variables for global settings or CI/CD integration.
- Use Params for DAG-specific or run-specific overrides.
- Use XComs for passing small pieces of data between tasks within a run.
Send prompts and reference code in Claude Code
You can ask Claude to explain, debug, or modify code. Claude automatically detects any text you have selected in the editor.
To explicitly reference a specific file or line range (e.g.,
@file.ts#5-10) in your prompt, use the following keyboard shortcut while text is selected:- Mac:
Option+K - Windows/Linux:
Alt+K
- Mac:
Manage Claude Code agent maps and background tasks
When subagents are active, an agent count appears at the bottom of the prompt box. Clicking this opens the Agent Map, which displays subagents as a tree showing status, elapsed time, and token count. You can click a subagent to view its prompt, tool calls, or stop it. Background tasks (like shell commands and monitors) are also listed below the agents in this map.