> ## 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.

# ओपनसाइंस

> केवल कॉन्फ़िग के साथ OpenScience को FlexInference पर इंगित करें।

OpenScience एक JSON फ़ाइल से एक प्रोवाइडर एंट्री पढ़ता है। एक स्टॉक बिल्ड को किसी सोर्स बदलाव की आवश्यकता नहीं होती है।

OpenScience कॉन्फ़िग में `start_within` सेट कर सकता है, इसलिए यहां एक agent key वैकल्पिक है। key अभी भी एक सरल तरीका है, क्योंकि यह बिना रीस्टार्ट के बदल जाती है। [agent keys](/hi/agent-keys) देखें।

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

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

<Accordion title="agent सेटअप प्रॉम्प्ट कॉपी करें">
  ```text theme={null}
  Configure OpenScience to send its requests to FlexInference. This is config only: no source change, no fork, no patch.

  You will never see or handle my API key. The provider entry stores only the `{env:FLEXINFERENCE_API_KEY}` template, and I export the value myself. Do not ask me for the key, and do not read it from my environment.

  1. Create a directory named `config/` and put `openscience.json` in it with this content:

  {
    "$schema": "https://syntheticsciences.ai/config.json",
    "model": "flexinference/gpt-5.6-sol",
    "provider": {
      "flexinference": {
        "name": "FlexInference",
        "env": ["FLEXINFERENCE_API_KEY"],
        "npm": "@ai-sdk/openai-compatible",
        "options": {
          "apiKey": "{env:FLEXINFERENCE_API_KEY}",
          "baseURL": "https://api.flexinference.com/v1"
        },
        "models": {
          "gpt-5.6-sol": {
            "name": "GPT-5.6 Sol",
            "reasoning": true,
            "tool_call": true
          }
        }
      }
    }
  }

  2. Print these lines for me to run. Do not run the export and do not ask for the value:

  export FLEXINFERENCE_API_KEY=<paste your key here>
  OPENSCIENCE_CONFIG_DIR=./config bun run dev

  3. Add `config/package.json`, `config/bun.lock`, and `config/node_modules/` to `.gitignore`. OpenScience writes those into any directory it loads config from on first run.

  Rules that matter, do not deviate:
  - Use `OPENSCIENCE_CONFIG_DIR`, not `OPENSCIENCE_CONFIG`. The first names a directory and scans it for commands, agents, and plugins. The second names a single file and scans nothing.
  - If I ask for a plugin, place the file at `config/plugins/<name>.js` and leave the `plugin` key out of the JSON entirely.
  - Tell me that any `.openscience` or `.synsc` directory inside a repository I open is also scanned for plugins, and that those plugins run with my exported key in the environment. Recommend I export the key only in the launch shell. Every entry in that array without a `file://` prefix is treated as an npm package name and handed to `bun add`, which fails and takes plugin startup down. The directory scan is one level deep and loads every `.js` and `.ts` sitting directly in `plugins/`, so keep shared modules outside it.
  - Do NOT put `start_within` in any model's `options`. FlexInference injects a key default only when the field is ABSENT, so writing it here permanently overrides my agent key's deadline with whatever you hardcoded. Only add it if I tell you I am not using an agent key.
  - Keep `options.apiKey` as the literal `{env:FLEXINFERENCE_API_KEY}` template. Never inline my key.
  - The top-level `model` field is what selects the provider. Without it OpenScience stays on its built-in default.
  - Every key under `models` is a slug sent verbatim on the wire, so it must be one FlexInference serves.

  Verify the file is valid JSON, then report what you created and the exact command to run.
  ```
</Accordion>

## OpenScience कॉन्फ़िगर करें

1. उस शेल में key एक्सपोर्ट करें जो OpenScience शुरू करता है।

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

2. प्रोवाइडर एंट्री को `openscience.json` में लिखें।

```json theme={null}
{
  "$schema": "https://syntheticsciences.ai/config.json",
  "model": "flexinference/gpt-5.6-sol",
  "provider": {
    "flexinference": {
      "name": "FlexInference",
      "env": ["FLEXINFERENCE_API_KEY"],
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "{env:FLEXINFERENCE_API_KEY}",
        "baseURL": "https://api.flexinference.com/v1"
      },
      "models": {
        "gpt-5.6-sol": {
          "name": "GPT-5.6 Sol",
          "reasoning": true,
          "tool_call": true
        }
      }
    }
  }
}
```

3. कॉन्फ़िग डायरेक्टरी सेट करके OpenScience शुरू करें।

```bash theme={null}
OPENSCIENCE_CONFIG_DIR=/path/to/config bun run dev
```

जब आपकी key डेडलाइन रखती है, तो `options` से `start_within` को हटा दें। हम केवल तभी एक संग्रहीत डिफ़ॉल्ट भरते हैं जब फ़ील्ड अनुपस्थित हो, इसलिए यहां एक मान हर अनुरोध पर key को ओवरराइड कर देगा।

इसके बजाय, जब आप agent key का उपयोग **नहीं** कर रहे हों, तो हर मॉडल पर `"start_within": "default"` सेट करें। यह सुरक्षित आधार रेखा है, क्योंकि बिना सेशन चयन के चुना गया मॉडल फिर गलती से रेसिंग करने के बजाय मानक रूप से रूट करता है।

## फ़ाइल कहाँ जाती है

OpenScience कई जगहों से कॉन्फ़िग को मर्ज करता है, और बाद वाला स्रोत जीतता है।

* OpenScience की कॉन्फ़िग डायरेक्टरी में ग्लोबल यूजर कॉन्फ़िग।
* `OPENSCIENCE_CONFIG`, एक कॉन्फ़िग फ़ाइल का पाथ।
* `synsc.jsonc`, `synsc.json`, `openscience.jsonc`, और `openscience.json` जो worktree रूट तक जाते हुए मिलते हैं, जब तक कि `OPENSCIENCE_DISABLE_PROJECT_CONFIG` सेट न हो।
* `OPENSCIENCE_CONFIG_CONTENT`, JSON को इनलाइन रखता है।
* उस वॉक पर प्रत्येक `.openscience` या `.synsc` डायरेक्टरी के अंदर वही चार नाम, साथ ही `OPENSCIENCE_CONFIG_DIR` द्वारा नामित कोई भी डायरेक्टरी।

दो पाथ वेरिएबल एक दूसरे के स्थान पर उपयोग नहीं किए जा सकते। `OPENSCIENCE_CONFIG` एक फ़ाइल का नाम देता है। `OPENSCIENCE_CONFIG_DIR` एक डायरेक्टरी का नाम देता है और पूरी चीज़ को कॉन्फ़िग के रूप में मानता है, इसे कमांड, agents और plugins के लिए स्कैन करता है। जब बंडल में JSON से अधिक हो तो डायरेक्टरी फॉर्म का उपयोग करें।

## इसे रखकर एक plugin लोड करें

OpenScience प्रत्येक कॉन्फ़िग डायरेक्टरी को `{plugin,plugins}/*.{ts,js}` के लिए स्कैन करता है और जो मिलता है उसे एक लोकल फ़ाइल के रूप में लोड करता है। फ़ाइल को `plugins/flex.js` पर रखें और JSON से `plugin` को हटा दें।

```
config/
  openscience.json
  plugins/
    flex.js
```

`plugin` में पाथ लिखने से काम नहीं चलेगा। OpenScience वहां हर एंट्री को `file://` प्रीफिक्स के बिना एक npm पैकेज नाम के रूप में पढ़ता है और इसे `bun add` को सौंपता है, इसलिए `"./plugins/flex.js"` इंस्टॉल होने में विफल रहता है और plugin स्टार्टअप को भी बंद कर देता है।

स्कैन एक स्तर गहरा होता है, और यह `plugins/` में सीधे स्थित हर `.js` और `.ts` को लेता है। साझा मॉड्यूल को उस डायरेक्टरी के बाहर रखें, अन्यथा OpenScience उन्हें भी plugins के रूप में लोड कर देगा।

पहली बार जब OpenScience किसी डायरेक्टरी से कॉन्फ़िग लोड करता है, तो वह `package.json`, `bun.lock`, `node_modules/`, और उन्हें कवर करने वाली एक `.gitignore` उसमें लिखता है। इनकी अपेक्षा करें, और उन्हें Git से बाहर रखें।

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

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

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

**एक plugin कभी लोड नहीं हुआ।** इसे `plugin` में नाम देने से यह `bun add` को एक पैकेज नाम के रूप में भेजता है, जो विफल हो जाता है और plugin स्टार्टअप को बंद कर देता है। फ़ाइल को कॉन्फ़िग डायरेक्टरी के अंदर `plugins/flex.js` पर रखें और JSON से `plugin` को हटा दें।

**एक हेल्पर मॉड्यूल एक plugin के रूप में लोड हुआ।** स्कैन `plugins/` में सीधे स्थित हर `.js` और `.ts` को लेता है। साझा मॉड्यूल को उस डायरेक्टरी के बाहर ले जाएं।

**अनुरोध हम तक कभी नहीं पहुंचते।** टॉप-लेवल `model` फ़ील्ड प्रोवाइडर का चयन करता है। इसके बिना OpenScience अपने बिल्ट-इन डिफ़ॉल्ट पर रहता है।

**[`401 invalid_api_key`](/hi/errors#invalid_api_key).** `FLEXINFERENCE_API_KEY` उस शेल में अनसेट है जिसने OpenScience शुरू किया था। लॉन्च करने से पहले इसे एक्सपोर्ट करें।

**[`400 flex_unsupported_for_anthropic`](/hi/errors#flex_unsupported_for_anthropic).** `options` में एक अवधि आपकी अपनी Anthropic key पर `claude-*` मॉडल तक पहुंच गई। [race](/hi/deadline-routing) जो एक Claude अवधि चलाती है, प्रबंधित keys लेती है। अवधि को हटा दें और key को डेडलाइन ले जाने दें।

**key की डेडलाइन कभी लागू नहीं होती।** एक मॉडल के `options` में `start_within` key पर जीत जाता है, क्योंकि हम केवल तभी एक संग्रहीत डिफ़ॉल्ट भरते हैं जब फ़ील्ड अनुपस्थित हो। इसे एंट्री से हटा दें।

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