Source: https://aiprimetech.io/codex-api/ # Codex API access for your coding workflow Connect Codex CLI to GPT-6.1 Sol, GPT-6 Astra, GPT-6 Luna or GPT-6 Sol through AI Prime Tech. Create a gateway key, select the matching access group and use the Responses API endpoint.

Get an API keySet up Codex CLI

AI Prime Tech is an independent API gateway. OpenAI develops Codex and the GPT models; your AI Prime Tech key and billing belong to this service. [Русская версия](/ru/codex-api/). ## What does “Codex API” mean? Codex is a coding agent. Its local client can connect to a model through an API provider. Here, “Codex API access” means connecting that client to AI Prime Tech's model gateway. You can also call the same supported GPT models from your own application through [our OpenAI-compatible API](/openai-api/). An API key is different from a ChatGPT subscription. Choose the route that matches where you want to work and who should bill the usage. Our [API key versus ChatGPT guide](/blog/codex-api-key-vs-chatgpt-subscription/) explains the distinction. ## Choose a GPT model | Model | Exact model ID | Starting point | | --- | --- | --- | | [GPT-6 Astra](/models/gpt-6-astra/) | `gpt-6-astra` | Complex reasoning, difficult debugging and broad technical investigations. | | [GPT-6.1 Sol](/models/gpt-6-1-sol/) | `gpt-6.1-sol` | A practical starting point for coding and agent workflows. | | [GPT-6 Luna](/models/gpt-6-luna/) | `gpt-6-luna` | Small changes, classification and frequent bounded tasks. | | [GPT-6 Sol](/models/gpt-6-sol/) | `gpt-6-sol` | Existing GPT-6 Sol integrations and migration comparisons. | These models have recent completed requests through our prepaid Codex group. Availability depends on the group attached to your key; check its model list before starting. For older GPT models, use the [full catalogue](/models/) and your key's returned model IDs. ## Codex API pricing and access types Prepaid access uses the **Codex** group. Add credits, create a key for that group and check the applicable model rate in your dashboard. Your cost depends on the model, input, output, caching and any enabled service options. A long agent task can make many requests. Prepaid access uses the **Codex** group. Check [available purchases](/register?next=/purchase) for any separately offered timed access and its current durations, prices and limits. A Claude timed plan belongs to a different group. Select the plan and key for the product you intend to use. Compare usage with a small, representative coding task first. OpenAI's published model prices describe direct OpenAI billing; your gateway's current rate and plan terms determine your AI Prime Tech charge. See [how to compare costs](/blog/gpt-6-models-for-codex/). ## Connect Codex CLI Set `AIPRIMETECH_API_KEY` in the environment of the terminal that will run Codex. Save this provider configuration in your user-level `~/.codex/config.toml`, merging it with your existing settings: ```toml model_provider = "aiprimetech" model = "gpt-6.1-sol" [model_providers.aiprimetech] name = "AI Prime Tech" base_url = "https://aiprimetech.io/v1" env_key = "AIPRIMETECH_API_KEY" wire_api = "responses" supports_websockets = false ``` Start `codex` and use `/status` to confirm the selected provider and model. For operating-system commands, a separate CLI profile and troubleshooting, follow the [complete Codex CLI setup guide](/docs/guides/codex-cli/). ## Before your first longer task 1. Confirm that your key belongs to the intended Codex group and that its balance or plan is active. 2. Check `GET https://aiprimetech.io/v1/models` with that key. 3. Run a short prompt with the exact model ID you selected. 4. Review the request and charge in your dashboard before a larger agent run. ## Common questions ### Does this include ChatGPT or Codex cloud? This page covers gateway API access. It does not grant a ChatGPT subscription or OpenAI-hosted Codex cloud access. OpenAI documents the supported sign-in methods in its [authentication guide](https://learn.chatgpt.com/docs/auth). ### Can I use a Claude key with GPT models? Use a key from a group that serves the model. A Claude-group key is not a general GPT key. If you want Claude inside Codex, see [the separate Claude setup](/learn/use-claude-api-with-codex/). ### Why does an older Codex configuration fail? Current Codex configuration uses `wire_api = "responses"`. Check the exact provider name, environment variable and `/v1` base URL. Do not put `/responses` into `base_url`; the client adds the endpoint path. [Troubleshooting and examples](/docs/guides/codex-cli/#troubleshooting).