Skip to content

Update openRouterRouting (including documentation) #2387

Description

@zmberber

What do you want to change?

  • In packages/ai/src/types.ts, add next to the already existing fields only and order also all missing fields that are specified in the provider object for the OpenRouter API.
    • Specifically, adding to only and order, the missing fields are allow_fallbacks, require_parameters, data_collection, zdr, enforce_distillable_text, ignore, quantizations, sort, preferred_min_throughput, preferred_max_latency, max_price
  • In the documentation of pi for models.json, remove "fallbacks": ["openai"] in compat in the object in the array providers.openrouter.models.
  • In the same documentation page, add the information that the object set in openRouterRouting is exactly what the provider field will be set to in the OpenRouter API.
  • In the same example as above, change"order": ["anthropic"] to "order": ["Anthropic"], as I believe the case is important to the OpenRouter API.

Why?

  • Even though everything gets passed anyway at runtime, the fields are not defined in typescript.
    • The runtime literally does params.provider = model.compat.openRouterRouting;, so what I am saying should all be true.
  • The current documentation seems to be wrong: Eventhough "fallbacks": ["openai"] in compat in the object in the array providers.openrouter.models would be passed as { "provider": { "fallbacks": ...} } in the OpenRouter API, this is not specified in the OpenRouter API.

How? (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions