الأكاديمية ← ميزات Hermesتوثيق رسمي · إرشاد عربي

توجيه الطلبات بين المزوّدين

Provider Routing

متوسط4 دقائق قراءةالدرس 173 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

المزوّد والنموذج: المزوّد هو الشركة التي تشغّل نموذج الذكاء الاصطناعي، والنموذج هو «العقل» الذي يفكّر لـHermes. Hermes نفسه لا يفكّر؛ هو ينظّم العمل ويستدعي النموذج. لذلك اختيار النموذج يحدّد جودة النتيجة وتكلفتها. القراءة نحو 4 دقائق. انتبه: الأغلى ليس دائمًا الأفضل لمهمتك. جرّب مهمة واحدة على نموذجين وقارن، وضع سقفًا للإنفاق من البداية.

5أقسام
15أمثلة برمجية
1جداول
0أوامر
623كلمة من المصدر
الوصف الرسمي في سطر

Configure OpenRouter or Nous Portal provider preferences to optimize for cost, speed, or quality.

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما المزوّد والنموذج ولماذا قد تحتاجه.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تعرف الخطأ الشائع: الأغلى ليس دائمًا الأفضل لمهمتك. جرّب مهمة واحدة على نموذجين وقارن، وضع سقفًا للإنفاق من البداية.
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Configuration
  2. 02Options
  3. 03Practical Examples
  4. 04How It Works
  5. 05Default Behavior
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

When using OpenRouter ↗ or Nous Portal as your LLM provider, Hermes Agent supports provider routing — fine-grained control over which underlying AI providers handle your requests and how they're prioritized.

OpenRouter routes requests to many providers (e.g., Anthropic, Google, AWS Bedrock, Together AI). Provider routing lets you optimize for cost, speed, quality, or enforce specific provider requirements.

Configuration

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير.

Add a provider_routing section to your ~/.hermes/config.yaml:

YAML7 أسطر
provider_routing:
  sort: "price"           # How to rank providers
  only: []                # Whitelist: only use these providers
  ignore: []              # Blacklist: never use these providers
  order: []               # Explicit provider priority order
  require_parameters: false  # Only use providers that support all parameters
  data_collection: null   # Control data collection ("allow" or "deny")

Options

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير.

sort

Controls how OpenRouter ranks available providers for your request.

ValueDescription
"price"Cheapest provider first
"throughput"Fastest tokens-per-second first
"latency"Lowest time-to-first-token first
YAMLسطران
provider_routing:
  sort: "price"

only

Whitelist of provider slugs. When set, only these providers will be used. All others are excluded. Use the lowercase slug shown by OpenRouter for each provider.

YAML4 أسطر
provider_routing:
  only:
    - "anthropic"
    - "google"

ignore

Blacklist of provider names. These providers will never be used, even if they offer the cheapest or fastest option.

YAML4 أسطر
provider_routing:
  ignore:
    - "together"
    - "deepinfra"

order

Explicit priority order. Providers listed first are preferred. Unlisted providers are used as fallbacks.

YAML5 أسطر
provider_routing:
  order:
    - "anthropic"
    - "google"
    - "amazon-bedrock"

requireparameters

When true, OpenRouter will only route to providers that support all parameters in your request (like temperature, top_p, tools, etc.). This avoids silent parameter drops.

YAMLسطران
provider_routing:
  require_parameters: true

datacollection

Controls whether providers can use your prompts for training. Options are "allow" or "deny".

YAMLسطران
provider_routing:
  data_collection: "deny"

Practical Examples

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير.

Optimize for Cost

Route to the cheapest available provider. Good for high-volume usage and development:

YAMLسطران
provider_routing:
  sort: "price"

Optimize for Speed

Prioritize low-latency providers for interactive use:

YAMLسطران
provider_routing:
  sort: "latency"

Optimize for Throughput

Best for long-form generation where tokens-per-second matters:

YAMLسطران
provider_routing:
  sort: "throughput"

Lock to Specific Providers

Ensure all requests go through a specific provider for consistency:

YAML3 أسطر
provider_routing:
  only:
    - "anthropic"

Avoid Specific Providers

Exclude providers you don't want to use (e.g., for data privacy):

YAML5 أسطر
provider_routing:
  ignore:
    - "together"
    - "lepton"
  data_collection: "deny"

Preferred Order with Fallbacks

Try your preferred providers first, fall back to others if unavailable:

YAML5 أسطر
provider_routing:
  order:
    - "anthropic"
    - "google"
  require_parameters: true

How It Works

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير.

Provider routing preferences are passed to OpenRouter or Nous Portal on agent chat requests and iteration-limit summaries via the extra_body.provider field. (extra_body is the OpenAI Python SDK argument; it becomes the top-level provider object in the JSON request.) Auxiliary tasks such as compression and title generation are configured independently under auxiliary.<task>.extra_body.

  • CLI mode — configured in ~/.hermes/config.yaml, loaded at startup
  • Gateway mode — same config file, loaded when the gateway starts

The routing config is read from config.yaml and passed as parameters when creating the AIAgent:

Text6 أسطر
providers_allowed  ← from provider_routing.only
providers_ignored  ← from provider_routing.ignore
providers_order    ← from provider_routing.order
provider_sort      ← from provider_routing.sort
provider_require_parameters ← from provider_routing.require_parameters
provider_data_collection    ← from provider_routing.data_collection

Default Behavior

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: المزوّد هو الشركة التي تشغّل نموذج الذكاء الاصطناعي، والنموذج هو «العقل» الذي يفكّر لـHermes.

When no provider_routing section is configured (the default), the aggregator uses its own default routing logic, which generally balances cost and availability automatically.

اختبار الفهم

3 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. في جدول هذا الدرس، ما «Description» المقابل لـ«"throughput"»؟
2. أي عنوان من التالي لا يظهر في هذا الدرس؟
3. أي مفتاح إعداد يظهر في أمثلة هذا الدرس؟