> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexinference.com/llms.txt
> Use this file to discover all available pages before exploring further.

# कोडेक्स

> कोडेक्स को FlexInference पर एक ऐसी key के साथ इंगित करें जिसमें deadline शामिल हो।

[Codex](https://developers.openai.com/codex/cli) अपना स्वयं का अनुरोध निकाय बनाता है, इसलिए आपके पास `start_within` रखने के लिए कोई जगह नहीं है। इसके बजाय deadline key पर जाती है। पहले एक बनाएं (देखें [agent keys](/hi/agent-keys))।

## इसे एक agent के साथ सेट करें

नीचे दिए गए ब्लॉक को खोलें और इसे किसी भी कोडिंग agent में कॉपी करें। प्रॉम्प्ट कभी भी आपकी API key नहीं मांगता है: agent बाकी सब कुछ कॉन्फ़िगर करता है, फिर आपके स्वयं चलाने के लिए एक export लाइन प्रिंट करता है।

<Accordion title="agent सेटअप प्रॉम्प्ट कॉपी करें">
  ```text theme={null}
  Configure the Codex CLI to send its requests to FlexInference. Do not change my existing Codex setup: create a separate profile I opt into per run.

  You will never see or handle my API key. The profile stores only the NAME of an environment variable, and I export the value myself. Do not ask me for the key, and do not read it from my environment.

  1. Create `~/.codex/flexinference.config.toml` with exactly this content:

  model = "gpt-5.6-sol"
  model_provider = "flexinference"

  [model_providers.flexinference]
  name = "FlexInference"
  base_url = "https://api.flexinference.com/v1"
  wire_api = "responses"
  env_key = "FLEX_API_KEY"

  2. Tell me to export the key myself, in the shell I will run Codex from:

     export FLEX_API_KEY=<paste your key here>

     Print that line for me to run. Do not run it, do not ask for the value, and do not add it to my shell profile.

  3. Tell me to start Codex with `codex --profile flexinference`.

  Rules that matter, do not deviate:
  - Keep the `model` line. Codex defaults to a slug ending in `-codex`, which FlexInference recognizes but holds no price for and never races. Use the full `gpt-5.6-sol`; the bare `gpt-5.6` alias makes Codex print a metadata warning.
  - Keep `wire_api = "responses"`. FlexInference serves that surface at `/v1/responses`.
  - Never add `service_tier`. FlexInference derives the tier from the key's deadline and returns `400 service_tier_not_allowed` if the request carries its own.
  - `env_key` and `auth` are mutually exclusive. Use `env_key` unless I ask for a keychain helper.
  - Do not set `request_max_retries`. My key may carry its own retry policy and the two stack.

  Verify by checking the file parses under `codex --profile flexinference --strict-config`, then report what you changed.
  ```
</Accordion>

## कोडेक्स कॉन्फ़िगर करें

Codex प्रत्येक प्रोफ़ाइल को अपनी फ़ाइल में रखता है। यह प्रोफ़ाइल आपके सामान्य Codex सेटअप को अकेला छोड़ देती है, और आप `--profile` के साथ प्रति रन ऑप्ट-इन करते हैं।

1. प्रोफ़ाइल फ़ाइल लिखें। इसे एक बार पेस्ट करें:

```bash theme={null}
mkdir -p ~/.codex && cat > ~/.codex/flexinference.config.toml <<'EOF'
model = "gpt-5.6-sol"
model_provider = "flexinference"

[model_providers.flexinference]
name = "FlexInference"
base_url = "https://api.flexinference.com/v1"
wire_api = "responses"
env_key = "FLEX_API_KEY"
EOF
```

2. उस key को export करें जिसे Codex पढ़ता है। प्रोफ़ाइल फ़ाइल इसे कभी नहीं रखती है।

```bash theme={null}
export FLEX_API_KEY=flex_live_...
```

3. प्रोफ़ाइल के साथ Codex शुरू करें।

```bash theme={null}
codex --profile flexinference
```

यह पूरा एकीकरण है। Codex `/v1/responses` को कॉल करता है, key को bearer token के रूप में भेजता है, और key deadline प्रदान करती है। सेशन हेडर उपयोग में आने वाले provider का नाम बताता है, ताकि आप देख सकें कि प्रोफ़ाइल ने काम किया।

इसके बजाय हर Codex रन पर हम तक पहुंचने के लिए, उन्हीं लाइनों को `~/.codex/config.toml` में डालें। वहां के टॉप-लेवल `model` और `model_provider` आपकी डिफ़ॉल्ट सेटिंग निर्धारित करते हैं।

`env_key` और `auth` एक-दूसरे को बाहर करते हैं। `env_key` आपके environment से key पढ़ता है, जो छोटा रास्ता है। इसके बजाय secrets को keychain में रखें और आप `env_key` को छोड़ दें, फिर `auth` में एक helper कमांड का नाम दें।

`model` लाइन को बनाए रखें। Codex अन्यथा `-codex` में समाप्त होने वाले slug पर डिफ़ॉल्ट होता है, जिसके लिए हमारे पास कोई कीमत नहीं है और हम कभी प्रतिस्पर्धा नहीं करते हैं। पूर्ण `gpt-5.6-sol` का उपयोग करें, क्योंकि केवल `gpt-5.6` alias Codex को एक metadata चेतावनी प्रिंट करने का कारण बनता है।

## पुष्टि करें कि key लागू हो गई है

प्रत्येक प्रतिक्रिया `x-flexinference-defaults-applied` के साथ आती है। Codex प्रतिक्रिया हेडर नहीं दिखाता है, इसलिए इसके बजाय **Logs** के तहत डैशबोर्ड में अनुरोध पढ़ें।

## समस्या निवारण

**हम तक कुछ भी नहीं पहुंचता है।** आपने एक साधारण `codex` चलाया, जो आपके सामान्य provider और खाते का उपयोग करता है। इसे `--profile flexinference` के साथ शुरू करें। आपने जो भी त्रुटि देखी वह उनकी है, जिसमें उपयोग सीमाएं भी शामिल हैं, और सेशन हेडर उपयोग में आने वाले provider का नाम बताता है।

**[`400 model_not_priced_for_managed`](/hi/errors#model_not_priced_for_managed)।** `model` अनसेट है, इसलिए अनुरोध एक `-codex` slug पर आया जिसके लिए हमारे पास कोई कीमत नहीं है। प्रोफ़ाइल में `model = "gpt-5.6-sol"` सेट करें। आपकी अपनी provider key पर हम इसके बजाय उस slug को चलाते हैं, जिसमें हमारी कोई लागत नहीं होती है।

**[`400 service_tier_not_allowed`](/hi/errors#service_tier_not_allowed)।** प्रोफ़ाइल `service_tier` सेट करती है, और हम इसके बजाय deadline से tier पढ़ते हैं। लाइन हटा दें।

**[`400 key_default_not_applicable`](/hi/errors#key_default_not_applicable) एक pinned route का नामकरण करता है।** अनुरोध एक क्लाउड रूट जैसे `foundry` को पिन करता है, जिसमें प्रतिस्पर्धा करने के लिए कोई सस्ता tier नहीं है। pinned route हटा दें, या key को एक tier में संपादित करें।

**प्रत्येक अनुरोध एक पूर्ण retry बजट खर्च करता है।** Codex का अपना `request_max_retries` है, और एक key `retry` नीति इसके साथ स्टैक करती है। एक या दूसरे को सेट करें, दोनों को नहीं।

**कर्सर इंतजार कर रहा है।** **Flex race** की लागत कम होती है और यह बाद में शुरू होता है, जिसे आप एक इंटरैक्टिव लूप में महसूस करते हैं। key की deadline को **Priority** या **Standard** में संपादित करें। अगला अनुरोध बिना किसी पुनरारंभ के इसे उठा लेगा।

हमारे द्वारा लौटाई गई प्रत्येक अस्वीकृति के लिए [errors](/hi/errors) देखें, और उन त्रुटियों के लिए [agent keys](/hi/agent-keys) देखें जो Codex के लिए विशिष्ट नहीं हैं।
