From b8fa953a3329bda8cdfd5881e075382392672640 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Fri, 6 Nov 2026 00:51:39 +0000 Subject: [PATCH 1/3] ## Python SDK Changes: * `open_router.guardrail_policies.list_account_policies()`: **Added** * `open_router.guardrail_policies.create_account_policy()`: **Added** * `open_router.guardrail_policies.delete_account_policy()`: **Added** * `open_router.guardrail_policies.update_account_policy()`: **Added** * `open_router.guardrail_policies.get_api_key_policy_assignment()`: **Added** * `open_router.guardrail_policies.change_api_key_policy_assignment()`: **Added** * `open_router.guardrail_policies.get_member_policy_assignment()`: **Added** * `open_router.guardrail_policies.change_member_policy_assignment()`: **Added** * `open_router.guardrail_policies.list_budget_policies()`: **Added** * `open_router.guardrail_policies.create_budget_policy()`: **Added** * `open_router.guardrail_policies.delete_budget_policy()`: **Added** * `open_router.guardrail_policies.get_budget_policy()`: **Added** * `open_router.guardrail_policies.update_budget_policy()`: **Added** * `open_router.guardrail_policies.list_model_availability_policies()`: **Added** * `open_router.guardrail_policies.create_model_availability_policy()`: **Added** * `open_router.guardrail_policies.delete_model_availability_policy()`: **Added** * `open_router.guardrail_policies.get_model_availability_policy()`: **Added** * `open_router.guardrail_policies.update_model_availability_policy()`: **Added** * `open_router.guardrail_policies.list_moderation_policies()`: **Added** * `open_router.guardrail_policies.create_moderation_policy()`: **Added** * `open_router.guardrail_policies.delete_moderation_policy()`: **Added** * `open_router.guardrail_policies.get_moderation_policy()`: **Added** * `open_router.guardrail_policies.update_moderation_policy()`: **Added** --- .speakeasy/gen.lock | 1375 ++- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 4154 +++++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/accountguardrailpolicy.mdx | 24 + .../accountguardrailpolicyrequest.mdx | 24 + .../accountguardrailpolicyresponse.mdx | 9 + docs/components/armor.mdx | 12 + docs/components/armorplugin.mdx | 2 +- .../{onerror.mdx => armorpluginonerror.mdx} | 6 +- .../budgetaccountguardrailpolicy.mdx | 20 + ...budgetaccountguardrailpolicypolicytype.mdx | 15 + .../budgetaccountguardrailpolicyrequest.mdx | 17 + ...uardrailpolicyrequestfloorreassignment.mdx | 13 + ...ccountguardrailpolicyrequestpolicytype.mdx | 15 + docs/components/budgetguardrailpolicy.mdx | 12 + .../budgetguardrailpolicydetail.mdx | 22 + .../budgetguardrailpolicydetailpolicytype.mdx | 15 + .../budgetguardrailpolicydetailreference.mdx | 22 + .../budgetguardrailpolicydetailresponse.mdx | 9 + .../budgetguardrailpolicypolicytype.mdx | 15 + .../budgetguardrailpolicyresponse.mdx | 9 + .../budgetguardrailpolicysummary.mdx | 19 + ...budgetguardrailpolicysummarypolicytype.mdx | 15 + ...changeguardrailpolicyassignmentrequest.mdx | 13 + ...drailpolicyassignmentrequestpolicytype.mdx | 24 + ...hangeguardrailpolicyassignmentresponse.mdx | 9 + docs/components/contentfilter.mdx | 11 + docs/components/contentfilterbuiltin.mdx | 12 + .../createbudgetguardrailpolicyrequest.mdx | 17 + ...budgetguardrailpolicyrequestpolicytype.mdx | 15 + ...odelavailabilityguardrailpolicyrequest.mdx | 17 + ...bilityguardrailpolicyrequestpolicytype.mdx | 15 + ...createmoderationguardrailpolicyrequest.mdx | 17 + ...rationguardrailpolicyrequestpolicytype.mdx | 15 + .../deleteguardrailpolicyresponse.mdx | 9 + .../guardrailbudgetpolicyauthoringconfig.mdx | 11 + ...dgetpolicyauthoringconfigresetinterval.mdx | 21 + .../guardrailbudgetpolicyconfig.mdx | 11 + ...modelavailabilitypolicyauthoringconfig.mdx | 29 + ...guardrailmodelavailabilitypolicyconfig.mdx | 29 + .../guardrailmoderationpolicyconfig.mdx | 21 + ...erationpolicyconfigcontentfilteraction.mdx | 21 + ...policyconfigcontentfilterbuiltinaction.mdx | 21 + .../guardrailmoderationpolicyconfigmode.mdx | 22 + ...guardrailmoderationpolicyconfigonerror.mdx | 22 + .../guardrailpolicyassignmentresponse.mdx | 9 + .../guardrailpolicyassignmentstate.mdx | 11 + .../lakerainjectionprotectionmode.mdx | 20 + .../listaccountguardrailpoliciesresponse.mdx | 10 + .../listbudgetguardrailpoliciesresponse.mdx | 10 + ...lavailabilityguardrailpoliciesresponse.mdx | 10 + ...istmoderationguardrailpoliciesresponse.mdx | 10 + .../modelarmorinjectionconfidencelevel.mdx | 21 + .../modelarmorinjectionprotectionmode.mdx | 20 + ...odelavailabilityaccountguardrailpolicy.mdx | 20 + ...bilityaccountguardrailpolicypolicytype.mdx | 15 + ...ilabilityaccountguardrailpolicyrequest.mdx | 17 + ...uardrailpolicyrequestfloorreassignment.mdx | 13 + ...ccountguardrailpolicyrequestpolicytype.mdx | 15 + .../modelavailabilityguardrailpolicy.mdx | 12 + ...modelavailabilityguardrailpolicydetail.mdx | 22 + ...abilityguardrailpolicydetailpolicytype.mdx | 15 + ...labilityguardrailpolicydetailreference.mdx | 22 + ...ilabilityguardrailpolicydetailresponse.mdx | 9 + ...lavailabilityguardrailpolicypolicytype.mdx | 15 + ...delavailabilityguardrailpolicyresponse.mdx | 9 + ...odelavailabilityguardrailpolicysummary.mdx | 19 + ...bilityguardrailpolicysummarypolicytype.mdx | 15 + .../moderationaccountguardrailpolicy.mdx | 20 + ...rationaccountguardrailpolicypolicytype.mdx | 15 + ...oderationaccountguardrailpolicyrequest.mdx | 17 + ...uardrailpolicyrequestfloorreassignment.mdx | 13 + ...ccountguardrailpolicyrequestpolicytype.mdx | 15 + docs/components/moderationguardrailpolicy.mdx | 12 + .../moderationguardrailpolicydetail.mdx | 23 + ...erationguardrailpolicydetailpolicytype.mdx | 15 + ...derationguardrailpolicydetailreference.mdx | 22 + ...oderationguardrailpolicydetailresponse.mdx | 9 + .../moderationguardrailpolicypolicytype.mdx | 15 + .../moderationguardrailpolicyresponse.mdx | 9 + .../moderationguardrailpolicysummary.mdx | 19 + ...rationguardrailpolicysummarypolicytype.mdx | 15 + .../components/outputmemoryservertoolitem.mdx | 16 +- .../outputmemoryservertoolitemaction.mdx | 21 + docs/components/piifilter.mdx | 11 + docs/components/piifilteraction.mdx | 21 + .../{actionenum.mdx => scanscope.mdx} | 11 +- docs/components/slug.mdx | 27 + .../updatebudgetguardrailpolicyrequest.mdx | 16 + ...odelavailabilityguardrailpolicyrequest.mdx | 16 + ...updatemoderationguardrailpolicyrequest.mdx | 16 + .../changeapikeypolicyassignmentglobals.mdx | 11 + .../changeapikeypolicyassignmentrequest.mdx | 13 + .../changememberpolicyassignmentglobals.mdx | 11 + .../changememberpolicyassignmentrequest.mdx | 13 + .../operations/createaccountpolicyglobals.mdx | 11 + .../operations/createaccountpolicyrequest.mdx | 12 + docs/operations/createbudgetpolicyglobals.mdx | 11 + docs/operations/createbudgetpolicyrequest.mdx | 12 + .../createmodelavailabilitypolicyglobals.mdx | 11 + .../createmodelavailabilitypolicyrequest.mdx | 12 + .../createmoderationpolicyglobals.mdx | 11 + .../createmoderationpolicyrequest.mdx | 12 + .../operations/deleteaccountpolicyglobals.mdx | 11 + .../operations/deleteaccountpolicyrequest.mdx | 12 + docs/operations/deletebudgetpolicyglobals.mdx | 11 + docs/operations/deletebudgetpolicyrequest.mdx | 13 + .../deletemodelavailabilitypolicyglobals.mdx | 11 + .../deletemodelavailabilitypolicyrequest.mdx | 13 + .../deletemoderationpolicyglobals.mdx | 11 + .../deletemoderationpolicyrequest.mdx | 13 + .../getapikeypolicyassignmentglobals.mdx | 11 + .../getapikeypolicyassignmentpolicytype.mdx | 24 + .../getapikeypolicyassignmentrequest.mdx | 14 + docs/operations/getbudgetpolicyglobals.mdx | 11 + docs/operations/getbudgetpolicyrequest.mdx | 13 + .../getmemberpolicyassignmentglobals.mdx | 11 + .../getmemberpolicyassignmentpolicytype.mdx | 24 + .../getmemberpolicyassignmentrequest.mdx | 14 + .../getmodelavailabilitypolicyglobals.mdx | 11 + .../getmodelavailabilitypolicyrequest.mdx | 13 + .../operations/getmoderationpolicyglobals.mdx | 11 + .../operations/getmoderationpolicyrequest.mdx | 13 + .../operations/listaccountpoliciesglobals.mdx | 11 + .../operations/listaccountpoliciesrequest.mdx | 13 + .../listaccountpoliciesresponse.mdx | 9 + docs/operations/listbudgetpoliciesglobals.mdx | 11 + docs/operations/listbudgetpoliciesrequest.mdx | 14 + .../operations/listbudgetpoliciesresponse.mdx | 9 + .../listmodelavailabilitypoliciesglobals.mdx | 11 + .../listmodelavailabilitypoliciesrequest.mdx | 14 + .../listmodelavailabilitypoliciesresponse.mdx | 9 + .../listmoderationpoliciesglobals.mdx | 11 + .../listmoderationpoliciesrequest.mdx | 14 + .../listmoderationpoliciesresponse.mdx | 9 + .../operations/updateaccountpolicyglobals.mdx | 11 + .../operations/updateaccountpolicyrequest.mdx | 13 + docs/operations/updatebudgetpolicyglobals.mdx | 11 + docs/operations/updatebudgetpolicyrequest.mdx | 13 + .../updatemodelavailabilitypolicyglobals.mdx | 11 + .../updatemodelavailabilitypolicyrequest.mdx | 13 + .../updatemoderationpolicyglobals.mdx | 11 + .../updatemoderationpolicyrequest.mdx | 13 + docs/sdks/guardrailpolicies/README.mdx | 1318 +++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 508 +- .../components/accountguardrailpolicy.py | 68 + .../accountguardrailpolicyrequest.py | 41 + .../accountguardrailpolicyresponse.py | 17 + src/openrouter/components/armorplugin.py | 6 +- .../budgetaccountguardrailpolicy.py | 77 + .../budgetaccountguardrailpolicyrequest.py | 106 + .../components/budgetguardrailpolicy.py | 34 + .../components/budgetguardrailpolicydetail.py | 134 + .../budgetguardrailpolicydetailresponse.py | 17 + .../budgetguardrailpolicyresponse.py | 14 + .../budgetguardrailpolicysummary.py | 94 + .../changeguardrailpolicyassignmentrequest.py | 50 + ...changeguardrailpolicyassignmentresponse.py | 15 + .../createbudgetguardrailpolicyrequest.py | 84 + ...modelavailabilityguardrailpolicyrequest.py | 84 + .../createmoderationguardrailpolicyrequest.py | 84 + .../deleteguardrailpolicyresponse.py | 15 + .../guardrailbudgetpolicyauthoringconfig.py | 45 + .../components/guardrailbudgetpolicyconfig.py | 61 + ...lmodelavailabilitypolicyauthoringconfig.py | 154 + .../guardrailmodelavailabilitypolicyconfig.py | 154 + .../guardrailmoderationpolicyconfig.py | 374 + .../guardrailpolicyassignmentresponse.py | 17 + .../guardrailpolicyassignmentstate.py | 26 + .../listaccountguardrailpoliciesresponse.py | 23 + .../listbudgetguardrailpoliciesresponse.py | 23 + ...elavailabilityguardrailpoliciesresponse.py | 23 + ...listmoderationguardrailpoliciesresponse.py | 23 + ...modelavailabilityaccountguardrailpolicy.py | 77 + ...ailabilityaccountguardrailpolicyrequest.py | 110 + .../modelavailabilityguardrailpolicy.py | 34 + .../modelavailabilityguardrailpolicydetail.py | 134 + ...ailabilityguardrailpolicydetailresponse.py | 17 + ...odelavailabilityguardrailpolicyresponse.py | 17 + ...modelavailabilityguardrailpolicysummary.py | 94 + .../moderationaccountguardrailpolicy.py | 77 + ...moderationaccountguardrailpolicyrequest.py | 106 + .../components/moderationguardrailpolicy.py | 34 + .../moderationguardrailpolicydetail.py | 140 + ...moderationguardrailpolicydetailresponse.py | 17 + .../moderationguardrailpolicyresponse.py | 17 + .../moderationguardrailpolicysummary.py | 94 + .../components/outputmemoryservertoolitem.py | 6 +- .../updatebudgetguardrailpolicyrequest.py | 78 + ...modelavailabilityguardrailpolicyrequest.py | 78 + .../updatemoderationguardrailpolicyrequest.py | 78 + src/openrouter/guardrail_policies.py | 7636 +++++++++++++++++ src/openrouter/operations/__init__.py | 352 + .../changeapikeypolicyassignment.py | 158 + .../changememberpolicyassignment.py | 158 + .../operations/createaccountpolicy.py | 148 + .../operations/createbudgetpolicy.py | 146 + .../createmodelavailabilitypolicy.py | 146 + .../operations/createmoderationpolicy.py | 146 + .../operations/deleteaccountpolicy.py | 144 + .../operations/deletebudgetpolicy.py | 156 + .../deletemodelavailabilitypolicy.py | 156 + .../operations/deletemoderationpolicy.py | 156 + .../operations/getapikeypolicyassignment.py | 176 + src/openrouter/operations/getbudgetpolicy.py | 156 + .../operations/getmemberpolicyassignment.py | 176 + .../operations/getmodelavailabilitypolicy.py | 156 + .../operations/getmoderationpolicy.py | 156 + .../operations/listaccountpolicies.py | 175 + .../operations/listbudgetpolicies.py | 182 + .../listmodelavailabilitypolicies.py | 182 + .../operations/listmoderationpolicies.py | 182 + .../operations/updateaccountpolicy.py | 160 + .../operations/updatebudgetpolicy.py | 158 + .../updatemodelavailabilitypolicy.py | 158 + .../operations/updatemoderationpolicy.py | 158 + src/openrouter/sdk.py | 4 + uv.lock | 2 +- 222 files changed, 24091 insertions(+), 74 deletions(-) create mode 100644 docs/components/accountguardrailpolicy.mdx create mode 100644 docs/components/accountguardrailpolicyrequest.mdx create mode 100644 docs/components/accountguardrailpolicyresponse.mdx create mode 100644 docs/components/armor.mdx rename docs/components/{onerror.mdx => armorpluginonerror.mdx} (77%) create mode 100644 docs/components/budgetaccountguardrailpolicy.mdx create mode 100644 docs/components/budgetaccountguardrailpolicypolicytype.mdx create mode 100644 docs/components/budgetaccountguardrailpolicyrequest.mdx create mode 100644 docs/components/budgetaccountguardrailpolicyrequestfloorreassignment.mdx create mode 100644 docs/components/budgetaccountguardrailpolicyrequestpolicytype.mdx create mode 100644 docs/components/budgetguardrailpolicy.mdx create mode 100644 docs/components/budgetguardrailpolicydetail.mdx create mode 100644 docs/components/budgetguardrailpolicydetailpolicytype.mdx create mode 100644 docs/components/budgetguardrailpolicydetailreference.mdx create mode 100644 docs/components/budgetguardrailpolicydetailresponse.mdx create mode 100644 docs/components/budgetguardrailpolicypolicytype.mdx create mode 100644 docs/components/budgetguardrailpolicyresponse.mdx create mode 100644 docs/components/budgetguardrailpolicysummary.mdx create mode 100644 docs/components/budgetguardrailpolicysummarypolicytype.mdx create mode 100644 docs/components/changeguardrailpolicyassignmentrequest.mdx create mode 100644 docs/components/changeguardrailpolicyassignmentrequestpolicytype.mdx create mode 100644 docs/components/changeguardrailpolicyassignmentresponse.mdx create mode 100644 docs/components/contentfilter.mdx create mode 100644 docs/components/contentfilterbuiltin.mdx create mode 100644 docs/components/createbudgetguardrailpolicyrequest.mdx create mode 100644 docs/components/createbudgetguardrailpolicyrequestpolicytype.mdx create mode 100644 docs/components/createmodelavailabilityguardrailpolicyrequest.mdx create mode 100644 docs/components/createmodelavailabilityguardrailpolicyrequestpolicytype.mdx create mode 100644 docs/components/createmoderationguardrailpolicyrequest.mdx create mode 100644 docs/components/createmoderationguardrailpolicyrequestpolicytype.mdx create mode 100644 docs/components/deleteguardrailpolicyresponse.mdx create mode 100644 docs/components/guardrailbudgetpolicyauthoringconfig.mdx create mode 100644 docs/components/guardrailbudgetpolicyauthoringconfigresetinterval.mdx create mode 100644 docs/components/guardrailbudgetpolicyconfig.mdx create mode 100644 docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx create mode 100644 docs/components/guardrailmodelavailabilitypolicyconfig.mdx create mode 100644 docs/components/guardrailmoderationpolicyconfig.mdx create mode 100644 docs/components/guardrailmoderationpolicyconfigcontentfilteraction.mdx create mode 100644 docs/components/guardrailmoderationpolicyconfigcontentfilterbuiltinaction.mdx create mode 100644 docs/components/guardrailmoderationpolicyconfigmode.mdx create mode 100644 docs/components/guardrailmoderationpolicyconfigonerror.mdx create mode 100644 docs/components/guardrailpolicyassignmentresponse.mdx create mode 100644 docs/components/guardrailpolicyassignmentstate.mdx create mode 100644 docs/components/lakerainjectionprotectionmode.mdx create mode 100644 docs/components/listaccountguardrailpoliciesresponse.mdx create mode 100644 docs/components/listbudgetguardrailpoliciesresponse.mdx create mode 100644 docs/components/listmodelavailabilityguardrailpoliciesresponse.mdx create mode 100644 docs/components/listmoderationguardrailpoliciesresponse.mdx create mode 100644 docs/components/modelarmorinjectionconfidencelevel.mdx create mode 100644 docs/components/modelarmorinjectionprotectionmode.mdx create mode 100644 docs/components/modelavailabilityaccountguardrailpolicy.mdx create mode 100644 docs/components/modelavailabilityaccountguardrailpolicypolicytype.mdx create mode 100644 docs/components/modelavailabilityaccountguardrailpolicyrequest.mdx create mode 100644 docs/components/modelavailabilityaccountguardrailpolicyrequestfloorreassignment.mdx create mode 100644 docs/components/modelavailabilityaccountguardrailpolicyrequestpolicytype.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicy.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicydetail.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicydetailpolicytype.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicydetailreference.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicydetailresponse.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicypolicytype.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicyresponse.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicysummary.mdx create mode 100644 docs/components/modelavailabilityguardrailpolicysummarypolicytype.mdx create mode 100644 docs/components/moderationaccountguardrailpolicy.mdx create mode 100644 docs/components/moderationaccountguardrailpolicypolicytype.mdx create mode 100644 docs/components/moderationaccountguardrailpolicyrequest.mdx create mode 100644 docs/components/moderationaccountguardrailpolicyrequestfloorreassignment.mdx create mode 100644 docs/components/moderationaccountguardrailpolicyrequestpolicytype.mdx create mode 100644 docs/components/moderationguardrailpolicy.mdx create mode 100644 docs/components/moderationguardrailpolicydetail.mdx create mode 100644 docs/components/moderationguardrailpolicydetailpolicytype.mdx create mode 100644 docs/components/moderationguardrailpolicydetailreference.mdx create mode 100644 docs/components/moderationguardrailpolicydetailresponse.mdx create mode 100644 docs/components/moderationguardrailpolicypolicytype.mdx create mode 100644 docs/components/moderationguardrailpolicyresponse.mdx create mode 100644 docs/components/moderationguardrailpolicysummary.mdx create mode 100644 docs/components/moderationguardrailpolicysummarypolicytype.mdx create mode 100644 docs/components/outputmemoryservertoolitemaction.mdx create mode 100644 docs/components/piifilter.mdx create mode 100644 docs/components/piifilteraction.mdx rename docs/components/{actionenum.mdx => scanscope.mdx} (59%) create mode 100644 docs/components/slug.mdx create mode 100644 docs/components/updatebudgetguardrailpolicyrequest.mdx create mode 100644 docs/components/updatemodelavailabilityguardrailpolicyrequest.mdx create mode 100644 docs/components/updatemoderationguardrailpolicyrequest.mdx create mode 100644 docs/operations/changeapikeypolicyassignmentglobals.mdx create mode 100644 docs/operations/changeapikeypolicyassignmentrequest.mdx create mode 100644 docs/operations/changememberpolicyassignmentglobals.mdx create mode 100644 docs/operations/changememberpolicyassignmentrequest.mdx create mode 100644 docs/operations/createaccountpolicyglobals.mdx create mode 100644 docs/operations/createaccountpolicyrequest.mdx create mode 100644 docs/operations/createbudgetpolicyglobals.mdx create mode 100644 docs/operations/createbudgetpolicyrequest.mdx create mode 100644 docs/operations/createmodelavailabilitypolicyglobals.mdx create mode 100644 docs/operations/createmodelavailabilitypolicyrequest.mdx create mode 100644 docs/operations/createmoderationpolicyglobals.mdx create mode 100644 docs/operations/createmoderationpolicyrequest.mdx create mode 100644 docs/operations/deleteaccountpolicyglobals.mdx create mode 100644 docs/operations/deleteaccountpolicyrequest.mdx create mode 100644 docs/operations/deletebudgetpolicyglobals.mdx create mode 100644 docs/operations/deletebudgetpolicyrequest.mdx create mode 100644 docs/operations/deletemodelavailabilitypolicyglobals.mdx create mode 100644 docs/operations/deletemodelavailabilitypolicyrequest.mdx create mode 100644 docs/operations/deletemoderationpolicyglobals.mdx create mode 100644 docs/operations/deletemoderationpolicyrequest.mdx create mode 100644 docs/operations/getapikeypolicyassignmentglobals.mdx create mode 100644 docs/operations/getapikeypolicyassignmentpolicytype.mdx create mode 100644 docs/operations/getapikeypolicyassignmentrequest.mdx create mode 100644 docs/operations/getbudgetpolicyglobals.mdx create mode 100644 docs/operations/getbudgetpolicyrequest.mdx create mode 100644 docs/operations/getmemberpolicyassignmentglobals.mdx create mode 100644 docs/operations/getmemberpolicyassignmentpolicytype.mdx create mode 100644 docs/operations/getmemberpolicyassignmentrequest.mdx create mode 100644 docs/operations/getmodelavailabilitypolicyglobals.mdx create mode 100644 docs/operations/getmodelavailabilitypolicyrequest.mdx create mode 100644 docs/operations/getmoderationpolicyglobals.mdx create mode 100644 docs/operations/getmoderationpolicyrequest.mdx create mode 100644 docs/operations/listaccountpoliciesglobals.mdx create mode 100644 docs/operations/listaccountpoliciesrequest.mdx create mode 100644 docs/operations/listaccountpoliciesresponse.mdx create mode 100644 docs/operations/listbudgetpoliciesglobals.mdx create mode 100644 docs/operations/listbudgetpoliciesrequest.mdx create mode 100644 docs/operations/listbudgetpoliciesresponse.mdx create mode 100644 docs/operations/listmodelavailabilitypoliciesglobals.mdx create mode 100644 docs/operations/listmodelavailabilitypoliciesrequest.mdx create mode 100644 docs/operations/listmodelavailabilitypoliciesresponse.mdx create mode 100644 docs/operations/listmoderationpoliciesglobals.mdx create mode 100644 docs/operations/listmoderationpoliciesrequest.mdx create mode 100644 docs/operations/listmoderationpoliciesresponse.mdx create mode 100644 docs/operations/updateaccountpolicyglobals.mdx create mode 100644 docs/operations/updateaccountpolicyrequest.mdx create mode 100644 docs/operations/updatebudgetpolicyglobals.mdx create mode 100644 docs/operations/updatebudgetpolicyrequest.mdx create mode 100644 docs/operations/updatemodelavailabilitypolicyglobals.mdx create mode 100644 docs/operations/updatemodelavailabilitypolicyrequest.mdx create mode 100644 docs/operations/updatemoderationpolicyglobals.mdx create mode 100644 docs/operations/updatemoderationpolicyrequest.mdx create mode 100644 docs/sdks/guardrailpolicies/README.mdx create mode 100644 src/openrouter/components/accountguardrailpolicy.py create mode 100644 src/openrouter/components/accountguardrailpolicyrequest.py create mode 100644 src/openrouter/components/accountguardrailpolicyresponse.py create mode 100644 src/openrouter/components/budgetaccountguardrailpolicy.py create mode 100644 src/openrouter/components/budgetaccountguardrailpolicyrequest.py create mode 100644 src/openrouter/components/budgetguardrailpolicy.py create mode 100644 src/openrouter/components/budgetguardrailpolicydetail.py create mode 100644 src/openrouter/components/budgetguardrailpolicydetailresponse.py create mode 100644 src/openrouter/components/budgetguardrailpolicyresponse.py create mode 100644 src/openrouter/components/budgetguardrailpolicysummary.py create mode 100644 src/openrouter/components/changeguardrailpolicyassignmentrequest.py create mode 100644 src/openrouter/components/changeguardrailpolicyassignmentresponse.py create mode 100644 src/openrouter/components/createbudgetguardrailpolicyrequest.py create mode 100644 src/openrouter/components/createmodelavailabilityguardrailpolicyrequest.py create mode 100644 src/openrouter/components/createmoderationguardrailpolicyrequest.py create mode 100644 src/openrouter/components/deleteguardrailpolicyresponse.py create mode 100644 src/openrouter/components/guardrailbudgetpolicyauthoringconfig.py create mode 100644 src/openrouter/components/guardrailbudgetpolicyconfig.py create mode 100644 src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py create mode 100644 src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py create mode 100644 src/openrouter/components/guardrailmoderationpolicyconfig.py create mode 100644 src/openrouter/components/guardrailpolicyassignmentresponse.py create mode 100644 src/openrouter/components/guardrailpolicyassignmentstate.py create mode 100644 src/openrouter/components/listaccountguardrailpoliciesresponse.py create mode 100644 src/openrouter/components/listbudgetguardrailpoliciesresponse.py create mode 100644 src/openrouter/components/listmodelavailabilityguardrailpoliciesresponse.py create mode 100644 src/openrouter/components/listmoderationguardrailpoliciesresponse.py create mode 100644 src/openrouter/components/modelavailabilityaccountguardrailpolicy.py create mode 100644 src/openrouter/components/modelavailabilityaccountguardrailpolicyrequest.py create mode 100644 src/openrouter/components/modelavailabilityguardrailpolicy.py create mode 100644 src/openrouter/components/modelavailabilityguardrailpolicydetail.py create mode 100644 src/openrouter/components/modelavailabilityguardrailpolicydetailresponse.py create mode 100644 src/openrouter/components/modelavailabilityguardrailpolicyresponse.py create mode 100644 src/openrouter/components/modelavailabilityguardrailpolicysummary.py create mode 100644 src/openrouter/components/moderationaccountguardrailpolicy.py create mode 100644 src/openrouter/components/moderationaccountguardrailpolicyrequest.py create mode 100644 src/openrouter/components/moderationguardrailpolicy.py create mode 100644 src/openrouter/components/moderationguardrailpolicydetail.py create mode 100644 src/openrouter/components/moderationguardrailpolicydetailresponse.py create mode 100644 src/openrouter/components/moderationguardrailpolicyresponse.py create mode 100644 src/openrouter/components/moderationguardrailpolicysummary.py create mode 100644 src/openrouter/components/updatebudgetguardrailpolicyrequest.py create mode 100644 src/openrouter/components/updatemodelavailabilityguardrailpolicyrequest.py create mode 100644 src/openrouter/components/updatemoderationguardrailpolicyrequest.py create mode 100644 src/openrouter/guardrail_policies.py create mode 100644 src/openrouter/operations/changeapikeypolicyassignment.py create mode 100644 src/openrouter/operations/changememberpolicyassignment.py create mode 100644 src/openrouter/operations/createaccountpolicy.py create mode 100644 src/openrouter/operations/createbudgetpolicy.py create mode 100644 src/openrouter/operations/createmodelavailabilitypolicy.py create mode 100644 src/openrouter/operations/createmoderationpolicy.py create mode 100644 src/openrouter/operations/deleteaccountpolicy.py create mode 100644 src/openrouter/operations/deletebudgetpolicy.py create mode 100644 src/openrouter/operations/deletemodelavailabilitypolicy.py create mode 100644 src/openrouter/operations/deletemoderationpolicy.py create mode 100644 src/openrouter/operations/getapikeypolicyassignment.py create mode 100644 src/openrouter/operations/getbudgetpolicy.py create mode 100644 src/openrouter/operations/getmemberpolicyassignment.py create mode 100644 src/openrouter/operations/getmodelavailabilitypolicy.py create mode 100644 src/openrouter/operations/getmoderationpolicy.py create mode 100644 src/openrouter/operations/listaccountpolicies.py create mode 100644 src/openrouter/operations/listbudgetpolicies.py create mode 100644 src/openrouter/operations/listmodelavailabilitypolicies.py create mode 100644 src/openrouter/operations/listmoderationpolicies.py create mode 100644 src/openrouter/operations/updateaccountpolicy.py create mode 100644 src/openrouter/operations/updatebudgetpolicy.py create mode 100644 src/openrouter/operations/updatemodelavailabilitypolicy.py create mode 100644 src/openrouter/operations/updatemoderationpolicy.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 5ce87411b..b5592e766 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: ca7e6ffbc81c23f4f96f028264d3a0c6 + docChecksum: a2c7148dfea3b69c10b8bd3f1c2e6162 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.132 - configChecksum: e6838479b1c5f69c83e3581e1ec5fdda + releaseVersion: 1.3.133 + configChecksum: 15120a6d2f0ea88a1482d84220892fc0 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: ed8669f6-9e68-4aa9-9ba3-bfbe3f645b6a - pristine_commit_hash: baca27461f2201c3c005cc8adafe4d3e558059d5 - pristine_tree_hash: 9696b5accb25cbb15b40e39f1214bd7e04273282 + generation_id: d3085a65-fd81-4205-8819-2a92e22407f2 + pristine_commit_hash: 75d38d4fec85a17eb99012f00f93d206d10fc2a9 + pristine_tree_hash: 51a4f2979f45a390ce302b335b2be1fe9f4e85d7 features: python: acceptHeaders: 3.0.0 @@ -86,6 +86,18 @@ trackedFiles: id: b174f975ca46 last_write_checksum: sha1:88a5b5a6c6a36afaa89c78643aef73d5adc87964 pristine_git_object: c3d65d7764f05a3d793818c96db82a296eea5290 + docs/components/accountguardrailpolicy.mdx: + id: 42130c3f40aa + last_write_checksum: sha1:914330c81418634ef46eb39a2594a40d7ffedfb5 + pristine_git_object: a1372e9c28c44af04d2076d2df0767f711f14ac8 + docs/components/accountguardrailpolicyrequest.mdx: + id: b7a59eb9f136 + last_write_checksum: sha1:a71a3ee723d6a48a10dfa0045494cf694ac12675 + pristine_git_object: be3cbc9b73dbef3b26f81c9c907f4e50b37bd020 + docs/components/accountguardrailpolicyresponse.mdx: + id: 641762a9090e + last_write_checksum: sha1:fb5d7a6af3d63351606f078136e73f4918809c7c + pristine_git_object: a6a51bb5d93c1bfa053e8f058a5721c9d64fe676 docs/components/accountscope.mdx: id: 3e961482a3fe last_write_checksum: sha1:96db1cf306be2ee08b9252a60564bf4bd8283f1a @@ -94,10 +106,6 @@ trackedFiles: id: 563aa2fef558 last_write_checksum: sha1:c50fdc4ca691c575f2151c01f49e87edc2b7a6fb pristine_git_object: a3e863c447fde2ab6df42622f817ab6c08293bd1 - docs/components/actionenum.mdx: - id: 80a6e5c8e11b - last_write_checksum: sha1:fd6ff66bb4a43dd71b399b9c5be55f79624b33bf - pristine_git_object: 9bed0a58221b443b943524232117bdc43e6c4014 docs/components/activityitem.mdx: id: 20be851aee8a last_write_checksum: sha1:4201d9840e79354c7d841123978de07dab2f7278 @@ -1286,6 +1294,10 @@ trackedFiles: id: 2092a26b770f last_write_checksum: sha1:3c54321def874ee0f948c6cd0159f62b46f86b88 pristine_git_object: 37a11b4646a4c9bc05f607791df32a53b10f4798 + docs/components/armor.mdx: + id: 0f018cebf580 + last_write_checksum: sha1:33c2566fe44af00386f388daffd7f62497252a7f + pristine_git_object: efd05a13f4395936cfcf4c9e0ab2db773e9c96c3 docs/components/armorautomode.mdx: id: 216687a0ff81 last_write_checksum: sha1:8fb9099ff8ba9c5f02d15735e324c2ae249d10f3 @@ -1300,8 +1312,8 @@ trackedFiles: pristine_git_object: ceaa389b0ee6684926f0fe44df3b2bf8d556ebf1 docs/components/armorplugin.mdx: id: ba12e2f5bccc - last_write_checksum: sha1:cb0f1eb6db25eca1503c78649a048719212a37d1 - pristine_git_object: d1281967c9c95f005c2eda525eb1dde9c52b9707 + last_write_checksum: sha1:145f06787c3c1aaa847a3679eaa0706810dd9031 + pristine_git_object: 27a96ad0bee09e1b05f5b78edc371e1e2c561fd7 docs/components/armorpluginid.mdx: id: b270c399d513 last_write_checksum: sha1:4117f686453f6eee1da7511cc0b496ad7d1d4a2d @@ -1310,6 +1322,10 @@ trackedFiles: id: 47e4aa4468b1 last_write_checksum: sha1:f86df139826a75a3a1d57cea86ed011a48970e08 pristine_git_object: b2d6e8ebedc973230a575ea388083b669b888e37 + docs/components/armorpluginonerror.mdx: + id: 7aa5abf3b565 + last_write_checksum: sha1:b24dae81f9398bf643f5d34b9f63184697c33699 + pristine_git_object: ca359faf06cdfd1cb2e853ada380856986865598 docs/components/armorrule.mdx: id: 9a38f0d9aae9 last_write_checksum: sha1:55b700ba1ba5ce1358406419eff3f9f678ccee99 @@ -1726,6 +1742,62 @@ trackedFiles: id: 3d683799f3f6 last_write_checksum: sha1:5809eec8a5a3ac96b49952f5345d606d50c0fef4 pristine_git_object: 4af2fa1e8e4e4e2c8eb2b3a0c83aa0a2efde22f4 + docs/components/budgetaccountguardrailpolicy.mdx: + id: f12fc1785329 + last_write_checksum: sha1:4a1d120ed38f9df85ba862b69fd546c9264c98a5 + pristine_git_object: 1d73f3e7312486f215423c9599f71fbbff67928a + docs/components/budgetaccountguardrailpolicypolicytype.mdx: + id: 826a0cedb2cd + last_write_checksum: sha1:1ba9ceb5d02a87792831afc4745b08f480d1d9bb + pristine_git_object: 973ef0ddc87750db02db6758597cd7f52fdff99c + docs/components/budgetaccountguardrailpolicyrequest.mdx: + id: 4af4e0232c7a + last_write_checksum: sha1:7795c79a19eaa3be99a7bc7fd243c641eb50c719 + pristine_git_object: 2ea32341120005ef887274afc3e891e839b8ce82 + docs/components/budgetaccountguardrailpolicyrequestfloorreassignment.mdx: + id: 6a253e1a62ae + last_write_checksum: sha1:324caee350eb00760c4e911b92c1b2e382f74fe5 + pristine_git_object: d003d37df0205bbf9fede011d69948877ac53a1c + docs/components/budgetaccountguardrailpolicyrequestpolicytype.mdx: + id: 97baf5b18ee6 + last_write_checksum: sha1:05e5eb09fe6b90baa825ef87c5cdea43586067c0 + pristine_git_object: e5f11ab2447e7daf4ed9e5558d1581cd117a4167 + docs/components/budgetguardrailpolicy.mdx: + id: 112a1a9352ec + last_write_checksum: sha1:ffb54f0ff5e86dfb0c6df960c041db13f5c49b63 + pristine_git_object: 5b27e3753860278cceb22c0afd576ab17ea6d999 + docs/components/budgetguardrailpolicydetail.mdx: + id: 65bffe20889a + last_write_checksum: sha1:1bf7e98454dc3e6895600b14b21c73480479a65e + pristine_git_object: 47b074dc5a4cdcc458c8d3a33fd67e7f37ecbc07 + docs/components/budgetguardrailpolicydetailpolicytype.mdx: + id: f6f527c90ffb + last_write_checksum: sha1:c0b955ee53fa40d911fb6d0a549bc6487a64fe39 + pristine_git_object: bcbb406dd472f9b0b576683ddf73a728b39c7ded + docs/components/budgetguardrailpolicydetailreference.mdx: + id: 51ecc8f7720a + last_write_checksum: sha1:dd317468f847273d4ff4caf48a402f259935e46c + pristine_git_object: 902967572aed54820b17c17039cb42eb9a08f206 + docs/components/budgetguardrailpolicydetailresponse.mdx: + id: 247276cb7be6 + last_write_checksum: sha1:4a94ce3bff4706fb3a6c59c28ac956d0876f24cb + pristine_git_object: fb261a4095bfd9ed835e9affbb68d84a6095f67b + docs/components/budgetguardrailpolicypolicytype.mdx: + id: feb59dd2446a + last_write_checksum: sha1:c7f8e7900049674f8ce3dc6d07e630e37ca482ba + pristine_git_object: 2acdbedbfd743dfbee52283bc51b8e672635aa5a + docs/components/budgetguardrailpolicyresponse.mdx: + id: 27d8f73ce009 + last_write_checksum: sha1:fabc16e36e3c6f8c2fa96949a318b264af6420ea + pristine_git_object: 0f46656d4daa7653e557bd3a495a53beb6d8112c + docs/components/budgetguardrailpolicysummary.mdx: + id: 4a7b772432b0 + last_write_checksum: sha1:544c3eb4ee99f7e21e7c5e6e9c6df458e00d9be3 + pristine_git_object: aa70ee8e596fc56fbaeb756ba78e453ab4794f57 + docs/components/budgetguardrailpolicysummarypolicytype.mdx: + id: 9bd85f652843 + last_write_checksum: sha1:7dec1bb6552c2e7a2264ff6f5212d8826cc0aa74 + pristine_git_object: 52cff38bcabc729a6e546449961340e0299d9937 docs/components/bulkaddworkspacemembersrequest.mdx: id: 92f44877345a last_write_checksum: sha1:352c607c34608b824f6ade55a63f380c1bca8305 @@ -1798,6 +1870,18 @@ trackedFiles: id: 34ac0e581d79 last_write_checksum: sha1:62ee9ccab6cec4572383cef654997ab4106d4676 pristine_git_object: ace8f22b972273bdee620a9981abcb0cc46d994e + docs/components/changeguardrailpolicyassignmentrequest.mdx: + id: 35619bc1d436 + last_write_checksum: sha1:253a32b8a6d92ecdd1c3038449404b876b695fe5 + pristine_git_object: f6d576cacd4c60034c2d4ce535cf390e98d6f481 + docs/components/changeguardrailpolicyassignmentrequestpolicytype.mdx: + id: a42946d02f73 + last_write_checksum: sha1:2ce4a2ac9c210a76ac1df21d544d6ac992d1245e + pristine_git_object: 36dea9cb8af3b602371227ec04e4b39324ff5721 + docs/components/changeguardrailpolicyassignmentresponse.mdx: + id: 6247bb0da7f3 + last_write_checksum: sha1:8b01abf315c7d2ae600685862cda689c6410d8c8 + pristine_git_object: b6b4b26bc5d920132a63227e40e2d38830c3b6eb docs/components/chatassistantimages.mdx: id: ffb19be9dace last_write_checksum: sha1:9adcd2ee786493cc2e83d551673e7d092a599f80 @@ -2466,10 +2550,18 @@ trackedFiles: id: 0dc55809c394 last_write_checksum: sha1:944e0827e53a39b70619306986e098359379fed1 pristine_git_object: 764214802b0ad8b198c7cf0ce4e9a04596dd4f5d + docs/components/contentfilter.mdx: + id: 83a303d0c87b + last_write_checksum: sha1:1702d57ba62adb36f2e6f1320a57f3f43c89c6f9 + pristine_git_object: 3257193527974e6b56bc9629e9579d3f5f6e5d3b docs/components/contentfilteraction.mdx: id: 11728ebb9679 last_write_checksum: sha1:7229d738394684c0cb32a45230469d182ca08520 pristine_git_object: 55e6d46227f6686d52c1d09268ec6eca8ffb32b8 + docs/components/contentfilterbuiltin.mdx: + id: b4a0f8c3ec3a + last_write_checksum: sha1:b9f574844dc50ece7ad0d91fa8474145eb1401f9 + pristine_git_object: d7d2aaf816439672880e54668a0f172ab11c3a2c docs/components/contentfilterbuiltinaction.mdx: id: 08bebf2def2b last_write_checksum: sha1:74b4771533db4f1dedb3403d6b5ea9bf0486f55d @@ -2650,6 +2742,14 @@ trackedFiles: id: 95926bee3413 last_write_checksum: sha1:6259afbe667548b161b3e0669bac2769eae0dc9d pristine_git_object: 63f7c7711d78d68cd27c258f391696266b406e52 + docs/components/createbudgetguardrailpolicyrequest.mdx: + id: de0b70ea9516 + last_write_checksum: sha1:20d3c84d410ea39de3881eae257a8a91ccbe3b9e + pristine_git_object: 159383d929d00a6dd6ddcf49bb86a51d8974cf15 + docs/components/createbudgetguardrailpolicyrequestpolicytype.mdx: + id: 24911ea91f67 + last_write_checksum: sha1:e36dfd48c97b8a20ce0b16cb542697bf489d61e5 + pristine_git_object: 75d065626ced9c4f737636bbc5948ff2722d536c docs/components/createbyokkeyrequest.mdx: id: 2af3019aa2a7 last_write_checksum: sha1:040551078aff6f0b3778dbeb2d4f7bac1809f39c @@ -2674,6 +2774,22 @@ trackedFiles: id: 1477eebdf505 last_write_checksum: sha1:e13e8bf981d83c771dfc6d3e4ab81a949487dbd3 pristine_git_object: 2501a2a5a0c6557094a66cb5b8f529fa5516e9e8 + docs/components/createmodelavailabilityguardrailpolicyrequest.mdx: + id: 4f756b818b48 + last_write_checksum: sha1:b03a271cbdbc8f1304d259734c8f6c2fe1ec82b1 + pristine_git_object: 1232d172f647f37616c28f09a801584cb01537fe + docs/components/createmodelavailabilityguardrailpolicyrequestpolicytype.mdx: + id: ebf64ca3901b + last_write_checksum: sha1:4ef123af623ab01b715274dcd9f129afbae76fb2 + pristine_git_object: bd2d34bf9bdff620f0668862333a1afb81db98a5 + docs/components/createmoderationguardrailpolicyrequest.mdx: + id: ce01f7d82903 + last_write_checksum: sha1:c2254f766742a5f28648acb35a8f864f183d251e + pristine_git_object: 6aa3e42c7281c677193d1cefd6efddf6566f5deb + docs/components/createmoderationguardrailpolicyrequestpolicytype.mdx: + id: 178698f14336 + last_write_checksum: sha1:a6ced09bc3e134b5b9f6740099461a8c180edc06 + pristine_git_object: c95bbced65547cea7697bf83f58cd006e31bd23f docs/components/createobservabilitydestinationrequest.mdx: id: 8d942a601a6e last_write_checksum: sha1:da999e345eb20237469002897cb38783b7e90c79 @@ -3050,6 +3166,10 @@ trackedFiles: id: abdf89311ee3 last_write_checksum: sha1:d4da606ec3dedef04dd981339e37a79d88e641e5 pristine_git_object: 5324227390b470c9315bc8b9dca2488ee76f6c57 + docs/components/deleteguardrailpolicyresponse.mdx: + id: ac04a55c46a6 + last_write_checksum: sha1:9442793da0ab4f7c91f05a77546ef1207b1c80dd + pristine_git_object: 65e93e684ea1be3d76f3d53aaaf39cedfb385416 docs/components/deleteguardrailresponse.mdx: id: 4b5aa42babb9 last_write_checksum: sha1:3221ecdebe12865bb2e0dc60c26a793517d4b82c @@ -4054,6 +4174,18 @@ trackedFiles: id: 91791d4c83b6 last_write_checksum: sha1:d1adf8ad6b61dbed5a1114202791c934a3db6632 pristine_git_object: 9095f97d749034bcce9ba14d22122a727e7db21b + docs/components/guardrailbudgetpolicyauthoringconfig.mdx: + id: 9e5753c7f2e8 + last_write_checksum: sha1:c1527680bab858136a3ceb69966af7aab285636b + pristine_git_object: a90f9e24ff71e110d4a423ebc78eec6c99ccc1f1 + docs/components/guardrailbudgetpolicyauthoringconfigresetinterval.mdx: + id: 729e1c5cc007 + last_write_checksum: sha1:595935414004e7f797ade5916376718a156d7ffe + pristine_git_object: 2bfbc780ec088d1fa8b372b3de735c3aaeabe4b8 + docs/components/guardrailbudgetpolicyconfig.mdx: + id: b9c0d87291e1 + last_write_checksum: sha1:8ffe2b41db9daf3a45d10574fe102d78ae350e9e + pristine_git_object: 53a7745e879e6610e80c0264617466bc06e9cf19 docs/components/guardraildataregion.mdx: id: d3be2a48aa20 last_write_checksum: sha1:81f1c0b515e1c1c13432cae9910ce77cb9991507 @@ -4062,6 +4194,42 @@ trackedFiles: id: ccedea0ab250 last_write_checksum: sha1:08342a9cceb4f7a5dc0b574a429d46af9d9a13f4 pristine_git_object: 9e0a058e6a19b68f470eb0938670dff51b47f4b5 + docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx: + id: ff434ead97c4 + last_write_checksum: sha1:5257228617f3d05d7a8f6f5a7d5db837b140cf13 + pristine_git_object: 5d929f0ba64529506f5af656e12525761fb053a6 + docs/components/guardrailmodelavailabilitypolicyconfig.mdx: + id: b6603993cee5 + last_write_checksum: sha1:14f5d89a02bd6c6171c8a9c178e4f3e5b0fad1f6 + pristine_git_object: 0090c1faf9737b90e78f2a1be88e284bb4f885e9 + docs/components/guardrailmoderationpolicyconfig.mdx: + id: 332531fba5ff + last_write_checksum: sha1:c31df107ce8f84fd8aefcae9ecfe0c2181aafd95 + pristine_git_object: edbdf4ccd13dcc454ea192cb4d29bb69d08e2ed9 + docs/components/guardrailmoderationpolicyconfigcontentfilteraction.mdx: + id: 7bc4e9f126ee + last_write_checksum: sha1:1218ec6745e459b4b079e7bb07268e4cadc2d84a + pristine_git_object: 6972266ee8b3fadf9e7fc9af5125407a7b132aea + docs/components/guardrailmoderationpolicyconfigcontentfilterbuiltinaction.mdx: + id: ebbbd1ee9405 + last_write_checksum: sha1:d9635ba741338d6c9e2c3ba9dc88e64ab07cb3bf + pristine_git_object: b16646b4e6008e764326234c0df878829c4b3750 + docs/components/guardrailmoderationpolicyconfigmode.mdx: + id: 00562b40f4cb + last_write_checksum: sha1:fb4de58fd15d1614512104c2f682e0383521944d + pristine_git_object: 0eaa11a966560ef8af44d4f38b9b3e17214273e1 + docs/components/guardrailmoderationpolicyconfigonerror.mdx: + id: fc837d9b1f4f + last_write_checksum: sha1:5c36a268f42649ee43e1bce0f4e65fcde47d9c29 + pristine_git_object: 60e882e0b23218b58f6fea408b7926725fd7b3c7 + docs/components/guardrailpolicyassignmentresponse.mdx: + id: 6f1c57d4e948 + last_write_checksum: sha1:a21b03e28c514517a40083a75b3d1ddb4a8918af + pristine_git_object: 1aa50c155fe07eb31065351c1fdca7c08b46fd72 + docs/components/guardrailpolicyassignmentstate.mdx: + id: 0cf03aaae204 + last_write_checksum: sha1:ed9fce833b772053b30fa82ff74bd81ed04767f3 + pristine_git_object: 39e4bb8c3227b3ed003dd12558e34fcc53dea8c2 docs/components/harddeny.mdx: id: 31284663ba89 last_write_checksum: sha1:471394bf5cb83396ec048d7eee07bf9e876e1553 @@ -4610,6 +4778,10 @@ trackedFiles: id: e031cc3f462c last_write_checksum: sha1:2506bc8b4e80b7b71b9f59a8d84a0367cfd3a119 pristine_git_object: bfef4620305e6517f0de3179cc1b9359ca3e43d2 + docs/components/lakerainjectionprotectionmode.mdx: + id: 6cbcf7a74986 + last_write_checksum: sha1:d930d667d2d5347d2d4eb915cdcf13a4bfad7c42 + pristine_git_object: c92f2ad3b1182c4163c6349db6c82f68b0cc72a8 docs/components/legacychatcontentvideo.mdx: id: fd222b8b9445 last_write_checksum: sha1:900e39e30b47e20e71edde59669225c91d36b1d6 @@ -4638,6 +4810,14 @@ trackedFiles: id: 241b46c3af41 last_write_checksum: sha1:87f6ccd952555f98fa58ea6231cb5e02dea633ba pristine_git_object: 84e5be99fde18ac05e85c2ec21e97204be5957c4 + docs/components/listaccountguardrailpoliciesresponse.mdx: + id: c40c5fdfaf95 + last_write_checksum: sha1:06f4f6e788a4d1aa92b91b8e2a1ed73f636e9ba4 + pristine_git_object: 733793a122be0bb387040e921a56c306b5d9b57e + docs/components/listbudgetguardrailpoliciesresponse.mdx: + id: 9808d7c20000 + last_write_checksum: sha1:d22a48d29eaaa9dabc3feb820b6d4a955b5a5c44 + pristine_git_object: bd4f3fcc81f9607df361b31274277b7372703391 docs/components/listbyokkeysresponse.mdx: id: be41921e1cce last_write_checksum: sha1:e135d933625d10b38e317f2695097f52d83a68ce @@ -4662,6 +4842,14 @@ trackedFiles: id: 54da8b0a1cbc last_write_checksum: sha1:31e334810325ce7f2374c8e84bdaf2901ab56676 pristine_git_object: 98c2d0f7fc352754c1bbc939f936f8a77ce19b7f + docs/components/listmodelavailabilityguardrailpoliciesresponse.mdx: + id: 561acea449d4 + last_write_checksum: sha1:4475c23fc4b5395c31a25ca5ca9c02706cf176dd + pristine_git_object: 9d4b742f729aaaa37d6626a10933f09949efabee + docs/components/listmoderationguardrailpoliciesresponse.mdx: + id: 7554504534fd + last_write_checksum: sha1:3b04e608b0b43e70f06751fecf403928a1f6df99 + pristine_git_object: ac61c54c564574be8c8d0549c1d9d3f2134fe12e docs/components/listobservabilitydestinationsresponse.mdx: id: cd603cde4c15 last_write_checksum: sha1:faaf64ab04910e03177da255d6f6fbc5738d8e8e @@ -5266,6 +5454,70 @@ trackedFiles: id: fe77e4816f6a last_write_checksum: sha1:9f73db7a6f9c3fc6841864c498a8002fcce64f9b pristine_git_object: 5c7708958e87a7c7f025cc40a17ad9faa5503dbb + docs/components/modelarmorinjectionconfidencelevel.mdx: + id: ce53416f2b66 + last_write_checksum: sha1:d12850d7d7e3ac9e69f079d29999f7fbd83c9e37 + pristine_git_object: 35fcd956692ac73e176ef1feda0af806b063c478 + docs/components/modelarmorinjectionprotectionmode.mdx: + id: 5f88f06ce21a + last_write_checksum: sha1:89a81198e0fd4f68e5bd6c9cb7811028f7f18af8 + pristine_git_object: 093486e3c33906efbdf4e4849b0a74a6ad98120e + docs/components/modelavailabilityaccountguardrailpolicy.mdx: + id: 8c0dd103659f + last_write_checksum: sha1:e2bda19979772101a9a366bc6e6cbadedb08638b + pristine_git_object: 7835ef2342479a1fcc3303fa9255eeb8dcb04944 + docs/components/modelavailabilityaccountguardrailpolicypolicytype.mdx: + id: bcd8052d5c5c + last_write_checksum: sha1:567b619292ada176a91554119b2a456f68342adf + pristine_git_object: 0036e91e9a924f7230e1be3b0c5a2f964bd20974 + docs/components/modelavailabilityaccountguardrailpolicyrequest.mdx: + id: 0bdc452e63ca + last_write_checksum: sha1:83f3bd1d1ac92170c02d1c41d85c0a5a059f505c + pristine_git_object: 4f2baabadf11dbe605376093bba7be01c802aa88 + docs/components/modelavailabilityaccountguardrailpolicyrequestfloorreassignment.mdx: + id: 994757dc76da + last_write_checksum: sha1:68676ffadbcdba2eff066de738538ed3337fb019 + pristine_git_object: 30d9bff41c2d6d854864959bee50159a0549d779 + docs/components/modelavailabilityaccountguardrailpolicyrequestpolicytype.mdx: + id: 6c376842a263 + last_write_checksum: sha1:b812788e602e3fa6e7dc12d0cd5fa31617b4c56c + pristine_git_object: d63e1f0f1d4decfc1e7e03bdf4f3b5ba5d424c87 + docs/components/modelavailabilityguardrailpolicy.mdx: + id: ca1403d56f14 + last_write_checksum: sha1:f7d57a3d7ff14630bcab6f708eef2901ab15029b + pristine_git_object: b58d4ff78abe19bb47b27b7b619cfdbeb0cbf42c + docs/components/modelavailabilityguardrailpolicydetail.mdx: + id: ad895926ceb5 + last_write_checksum: sha1:5f0a9b88f728ab92daecf3da21e7ee7bcd3f055e + pristine_git_object: adfcfaef99c39d0b11172a7c6171a7af8d0faa61 + docs/components/modelavailabilityguardrailpolicydetailpolicytype.mdx: + id: 4f39f62b1740 + last_write_checksum: sha1:14a8a5cdc20d1c42a4056b98b90e645ed2d89f13 + pristine_git_object: 7fc4b61ab845c8c960fbf81c0c1bd4b59911dfd9 + docs/components/modelavailabilityguardrailpolicydetailreference.mdx: + id: 83f3bb3a932d + last_write_checksum: sha1:44a606f6e2a5646fa51e5ab08797be5135a92acc + pristine_git_object: a86d9d9095dc15eaca493aecb686a995faab08f9 + docs/components/modelavailabilityguardrailpolicydetailresponse.mdx: + id: b1638da69576 + last_write_checksum: sha1:9d5193e9881bebad9a0205db78101e36d6b8f701 + pristine_git_object: caa765235480319733bb64184a5d6d5413ab539c + docs/components/modelavailabilityguardrailpolicypolicytype.mdx: + id: e7afbcd89435 + last_write_checksum: sha1:d23fac51a3a11331be7b3f23645a6cbde4de232b + pristine_git_object: bf84bcc1e191c4553476ed083a8bbb5464f556ec + docs/components/modelavailabilityguardrailpolicyresponse.mdx: + id: 8a808473f771 + last_write_checksum: sha1:7611cda4020fed189a9970609410f7de33238808 + pristine_git_object: 85a9a5dcabf5a7194ad9fe6d5db4070bbaf73a66 + docs/components/modelavailabilityguardrailpolicysummary.mdx: + id: 47a409ae00b8 + last_write_checksum: sha1:c16268ff49b73492445c549b29aaa12eb5d7d3ea + pristine_git_object: ee7c403b51674a410faf7e0416c09d570f0cf74f + docs/components/modelavailabilityguardrailpolicysummarypolicytype.mdx: + id: 207db4a0f651 + last_write_checksum: sha1:cfc62979e865c75580f567acfc66bea042eb50d2 + pristine_git_object: aa249e0b80016a508217b2e71857980148df1cf8 docs/components/modelbenchmarks.mdx: id: a56406a8820b last_write_checksum: sha1:433bba8f8155452134d1fe6942b48ac1f0950b6c @@ -5306,6 +5558,62 @@ trackedFiles: id: d145b88b8b67 last_write_checksum: sha1:ed7cedc44d3043ef40007d3135774d168b30683d pristine_git_object: 74bc3fbb631e6f8a7d1f37012bb7e591cf73c21e + docs/components/moderationaccountguardrailpolicy.mdx: + id: f44dff301854 + last_write_checksum: sha1:902afd85c7ce5ff389df38637d2af79985d9e161 + pristine_git_object: b64ae310747ec9ca0ddf3c1211a444ad7c7a696f + docs/components/moderationaccountguardrailpolicypolicytype.mdx: + id: 91ec0fc4a8ee + last_write_checksum: sha1:b2c0fd2ef41d04ab94774ad76defd466ece9b9de + pristine_git_object: fc9a40762546def5140eb3d2e51acab65c7239ff + docs/components/moderationaccountguardrailpolicyrequest.mdx: + id: aaa9e05c8b21 + last_write_checksum: sha1:c384b33af6ae1cd3f9f39a30d860938850ffcaa8 + pristine_git_object: 605e3f5e5f25c99162aac543ceec3a6b6a4700be + docs/components/moderationaccountguardrailpolicyrequestfloorreassignment.mdx: + id: 730d11c7b74c + last_write_checksum: sha1:52dae722cf423f5a1476565b2c62f2444926e2cf + pristine_git_object: c5a168782f89c585f2938da47b0dcc4c8a8c85a2 + docs/components/moderationaccountguardrailpolicyrequestpolicytype.mdx: + id: 3f2cde01604f + last_write_checksum: sha1:6f073bf7aa378bad2ce285a89441c8a1eb01512a + pristine_git_object: c1095adc2581b1e1f1ddfb105a642317402426a8 + docs/components/moderationguardrailpolicy.mdx: + id: b8ce75707162 + last_write_checksum: sha1:ef77ea9ccbcf7d51f19e1d5e0c8b3f8c679b7861 + pristine_git_object: 9092f187cc6344f6eed091a06df44bbd611864ce + docs/components/moderationguardrailpolicydetail.mdx: + id: a549d1d62d6b + last_write_checksum: sha1:dcde5403cd21a4c4eb0f8bac59132c515c0f9aa3 + pristine_git_object: 162de7e17cbbf834e71e9ceef30eaec7860d358b + docs/components/moderationguardrailpolicydetailpolicytype.mdx: + id: a665f50f034f + last_write_checksum: sha1:42b7161041702fb136263c28b42c3e9c7867dcca + pristine_git_object: 40d072cd0a9582ac6e0b80ec19448a9e3d2a12ed + docs/components/moderationguardrailpolicydetailreference.mdx: + id: 7ec52d3db586 + last_write_checksum: sha1:0c737e68af79eec34a436ed273d7c73f1c3ac485 + pristine_git_object: 8259566820461b8dcf3b269a21c5d450f0916970 + docs/components/moderationguardrailpolicydetailresponse.mdx: + id: f99bd49df4e7 + last_write_checksum: sha1:0f5884d8e38801258c043edf019ae6df411d55d5 + pristine_git_object: 1e6bc921067f01fe77b267358e4972bf564231f7 + docs/components/moderationguardrailpolicypolicytype.mdx: + id: 3868653ff6d5 + last_write_checksum: sha1:d6cdab33aa2736be142151e1266281a756935fc6 + pristine_git_object: 0092e28bf2989ee9ae6308db618e825b2d96a575 + docs/components/moderationguardrailpolicyresponse.mdx: + id: e06bfb74d7e2 + last_write_checksum: sha1:4886e253711141289f426c616998161c4b1e27d7 + pristine_git_object: 7912e09b6a4abf25376f05d01441a2a785b246c8 + docs/components/moderationguardrailpolicysummary.mdx: + id: c040c19261ec + last_write_checksum: sha1:19b55cde0552db45fe2d11bb798853f8b4b0b633 + pristine_git_object: 8b93d17cdd4a505808099a1723bf8a11f5574658 + docs/components/moderationguardrailpolicysummarypolicytype.mdx: + id: 6b97f25898ae + last_write_checksum: sha1:36d7818261d60e8f68467c0e690f6d87041e725a + pristine_git_object: deabfaa8c84d719db988b8d4f3ffc661a022850f docs/components/moderationplugin.mdx: id: ea978b62d906 last_write_checksum: sha1:e46d24d3d7e7ec89ba392076a579c829bde93ef4 @@ -5606,10 +5914,6 @@ trackedFiles: id: 35262d81b0a1 last_write_checksum: sha1:53220ed66cf059d9f06df81b7f5bb0f2d87f5283 pristine_git_object: bf3c27b8d2da352bd80bb18179159839e69b9b0a - docs/components/onerror.mdx: - id: 652a1db16dbe - last_write_checksum: sha1:e9b7ccb3ef20c9c5c1536fa88bfdc57e94d3717a - pristine_git_object: fd5c6bab1fcc801cfc9d41077f7ae22c3c89f2ac docs/components/openaifile.mdx: id: 455c97feac56 last_write_checksum: sha1:742079f59c6a288349f47e2c679af3689964e986 @@ -6400,8 +6704,12 @@ trackedFiles: pristine_git_object: 9bf8367aa6a8a7503f85af91c3dc6a221e8512e3 docs/components/outputmemoryservertoolitem.mdx: id: 92da20c0ab0a - last_write_checksum: sha1:8048e185a9a1c845cc9a3a932c7b4ce4570261a3 - pristine_git_object: fe6c3ecee37c6a39c9fdaca3f4b1b22e4abbef24 + last_write_checksum: sha1:f6fa27336ffac6426a7d988f8172b5e03958d929 + pristine_git_object: f22c53ef0fabd2d051efd0b9cde76aacf5ddabd1 + docs/components/outputmemoryservertoolitemaction.mdx: + id: 51660cc2e52a + last_write_checksum: sha1:3713063a2af89f9a948b6e920f4b2458bcbc5b68 + pristine_git_object: e4686f6b5b97dfb74f1ebf31bae673c2a53648b4 docs/components/outputmemoryservertoolitemtype.mdx: id: 7abbcaea1834 last_write_checksum: sha1:f3c98d03ac6bca67329e32b7792d4171e53291b3 @@ -6778,6 +7086,14 @@ trackedFiles: id: a503880c4645 last_write_checksum: sha1:f038145f0a077c2365411be7f10e24ef5d01dbf3 pristine_git_object: fe172997e0c96a1a31650d492a25ed8b7265895c + docs/components/piifilter.mdx: + id: ea137ead0a73 + last_write_checksum: sha1:448fead4a8f9a62382253b8e0275218aebf0a24c + pristine_git_object: 45d0708f80880890e17fcf5e29d7668d66e3c3ce + docs/components/piifilteraction.mdx: + id: 6d3a1e57d510 + last_write_checksum: sha1:afe6f98d16102d23e8806fc7196b609ea7a33ecd + pristine_git_object: 6e7977acb39b0251208055a271a26da3a8361ca6 docs/components/pipelinestage.mdx: id: d61180ec88b0 last_write_checksum: sha1:bda69ac74ba33abb96248550b06e41808753d06f @@ -7426,6 +7742,10 @@ trackedFiles: id: 4b983382548d last_write_checksum: sha1:49a8b76b0dbb5db23d48a810d2038fee486ea5c7 pristine_git_object: 2990666b8043c110aac529e0217e0d988e99ba80 + docs/components/scanscope.mdx: + id: 62b10a565c84 + last_write_checksum: sha1:26eabf9fd5ab8d687a264c3051088ce1a5dcdef2 + pristine_git_object: 7d0925fded4a894e2d45356049a96eb8fb8f0156 docs/components/scimgroup.mdx: id: bc553f57b8ab last_write_checksum: sha1:768cf359184a60ded6ab1fc3a0b652c884e55381 @@ -7662,6 +7982,10 @@ trackedFiles: id: 6e4a8f0b619e last_write_checksum: sha1:8cae69afba431966f5bbf96a050b5d466f773b96 pristine_git_object: 1e31f135652815e74020626541e1ad26f97ddc60 + docs/components/slug.mdx: + id: 4c78d3b2c332 + last_write_checksum: sha1:04e5011ee63139fb70dc8251f179a8af84a28a80 + pristine_git_object: 64c2b8bb8b2d42ff18757e95750ccfe7a8364995 docs/components/softdeny.mdx: id: d113e0c596b9 last_write_checksum: sha1:56c1888fc6437e170d31ceabfa505cc1aad87ce2 @@ -8542,6 +8866,10 @@ trackedFiles: id: 7171837ab497 last_write_checksum: sha1:044b2f7ace318e2e7a035b8df210b5718bd79577 pristine_git_object: d83b029130cebd5e3786d316165080a8bd25aa2f + docs/components/updatebudgetguardrailpolicyrequest.mdx: + id: 519fb4a45a36 + last_write_checksum: sha1:bddc8c9f1255437c5b9e7c0e2b44b4f0dedcc140 + pristine_git_object: 9d0aae756b2150d32d2183f554a11c00f8e41333 docs/components/updatebyokkeyrequest.mdx: id: db0862ec6814 last_write_checksum: sha1:8e319e6b8d763a001d95058ae922098949d35d40 @@ -8566,6 +8894,14 @@ trackedFiles: id: e00dc0a0c6e0 last_write_checksum: sha1:dc52c008c9414a86215db2c8d74732ed37f71c09 pristine_git_object: 537a5707008550b81c5eaf25a4c8668b1b92849c + docs/components/updatemodelavailabilityguardrailpolicyrequest.mdx: + id: b794752808db + last_write_checksum: sha1:417be1743e3fa1dddf29cda3869d745be67e8942 + pristine_git_object: 46261200d151c2190e5a7670537025af246149ff + docs/components/updatemoderationguardrailpolicyrequest.mdx: + id: ce45cbddb95a + last_write_checksum: sha1:230402bc542776d5faed9485284948aed13248ae + pristine_git_object: c39a57e70ffce0421a35733713ccc1b682eb77fa docs/components/updateobservabilitydestinationrequest.mdx: id: b54091567003 last_write_checksum: sha1:f5457a557dc48d54008d811fa2c47f3e8633272d @@ -9158,6 +9494,22 @@ trackedFiles: id: db4a10e02011 last_write_checksum: sha1:3be9f4acdea977d0907288f33ed0f79fe3389443 pristine_git_object: ed8aded072683a1daefb4174a1c85e367e845cdd + docs/operations/changeapikeypolicyassignmentglobals.mdx: + id: beeb3f2813ca + last_write_checksum: sha1:1a0ef422718684ceca1dc4f96c37214f833439f4 + pristine_git_object: 2a2df3b453d1cbc65e82a2185e476cfe84dfb063 + docs/operations/changeapikeypolicyassignmentrequest.mdx: + id: 2e4bfcc9ecba + last_write_checksum: sha1:0ff10e3b0726b4059f3d36b96635d39ea34b6a03 + pristine_git_object: 61c6d6417e80da6107836e6037de6650a0405a10 + docs/operations/changememberpolicyassignmentglobals.mdx: + id: cdf723c815c9 + last_write_checksum: sha1:6ad6d9dfe3da8de9c95e1fb355743b6dd74c4a4b + pristine_git_object: 3a7aa244cc7bc226cbffd5e92b85cc1adc21799a + docs/operations/changememberpolicyassignmentrequest.mdx: + id: 31abe05b5385 + last_write_checksum: sha1:35abf5c30ac2890aa91804881fdc144b4ea59fd9 + pristine_git_object: 8741e0dcc2669edf5f22f4fac893c1a9b0ad03ba docs/operations/classifierdimensions.mdx: id: 5e48dede0ae4 last_write_checksum: sha1:54e7f9e4298d38c81cbf94c6bf4c5c0e2814bf05 @@ -9194,6 +9546,14 @@ trackedFiles: id: 9040b392c33c last_write_checksum: sha1:704e89a47df38dbda76e374233bdc18c549cb6ee pristine_git_object: b0c2e5ad44485b44b4b034b750e745dbde944937 + docs/operations/createaccountpolicyglobals.mdx: + id: 896e34a77bb9 + last_write_checksum: sha1:389b3c419935273e456335aa19690808ca690ae6 + pristine_git_object: 85c4a24144a12e618de0763674c41fc6a9b1f915 + docs/operations/createaccountpolicyrequest.mdx: + id: fe37886923be + last_write_checksum: sha1:ee2821d3d57aa14f26f49eebd7eec070a64ac2cd + pristine_git_object: ea541568f2ce1ae544b27fc3ed721c9b8add7232 docs/operations/createapialphadecisionsglobals.mdx: id: 0876f1e7d3f2 last_write_checksum: sha1:2aae8b59a3698aaeb64d50e6507b4bb0e81cf9f6 @@ -9274,6 +9634,14 @@ trackedFiles: id: 116d6b57d04f last_write_checksum: sha1:ed02b8745e09acad909858fa2bbf3f59fc75c2d2 pristine_git_object: 4d05051511fd8f9ad725540124e9141097e5da94 + docs/operations/createbudgetpolicyglobals.mdx: + id: 7b9d5ab7f9d7 + last_write_checksum: sha1:e0417797a12213bc072ccd94fbc80a5a564ccb7d + pristine_git_object: e3cda40c17cfc44ae84a04076d0efa96b3faa148 + docs/operations/createbudgetpolicyrequest.mdx: + id: 34f086e8d630 + last_write_checksum: sha1:3fe8bce69787876ed69833c1020be4b689fb9ee5 + pristine_git_object: 8a5cce6e106007a5e7fa060da76bd70ecef3e1ba docs/operations/createbyokkeyglobals.mdx: id: e631e8e4e0fb last_write_checksum: sha1:d686a7ac2187feb8db7c05f926ea8443dc0f09de @@ -9362,6 +9730,22 @@ trackedFiles: id: 08e825fab080 last_write_checksum: sha1:ad171dae3c841d8f21b63a8266c79f22b2d5310c pristine_git_object: f3f11ab333c352305e6b30e417ad2ee7966fb061 + docs/operations/createmodelavailabilitypolicyglobals.mdx: + id: c33abd60f8a4 + last_write_checksum: sha1:de5a9222b8875f9c206f5d29c9c5001d1e5105a4 + pristine_git_object: c156180212ddb3003e60a5787d8805a252522aae + docs/operations/createmodelavailabilitypolicyrequest.mdx: + id: 095516d2a82f + last_write_checksum: sha1:0f8e06c535db7806b3ea1fdeb273137e427f977c + pristine_git_object: db345f9644e7003d1c1270a95e4476b5b0f3dea3 + docs/operations/createmoderationpolicyglobals.mdx: + id: a33c5d3cdfa5 + last_write_checksum: sha1:fa78de532e6c80e868a4afb6750c82a696033205 + pristine_git_object: 234bae656a59cdfab074e360ff3f845b0d078161 + docs/operations/createmoderationpolicyrequest.mdx: + id: 71f154fcfb33 + last_write_checksum: sha1:6bda980ecf8ced077ca2d35f314d9b159ba2ea6e + pristine_git_object: 943b39040d51a419b9e9447f43b6979077d26132 docs/operations/createoauthtokenglobals.mdx: id: 253b06bd452b last_write_checksum: sha1:5e090162550adcc47ec690762917952199bb118d @@ -9506,6 +9890,14 @@ trackedFiles: id: bf5ee96a37bd last_write_checksum: sha1:c0e9c06f8a484108aaf5a39fcbf4bc712193bc0c pristine_git_object: 03cecfd4ec0719a6f5a1b8ea3ae2480f76b650aa + docs/operations/deleteaccountpolicyglobals.mdx: + id: 06d88625b24e + last_write_checksum: sha1:c05404597eb64f01250fcf88c4d0311c75aadc5e + pristine_git_object: ed5c2dad6f575c82b23c618ff7f5fd33c18d8028 + docs/operations/deleteaccountpolicyrequest.mdx: + id: f57a64521225 + last_write_checksum: sha1:b4b572e335321630e15000f96781e2032530e6e2 + pristine_git_object: d494df9bbc958118993a12be7b7262a4411627e3 docs/operations/deletebatchglobals.mdx: id: 800f062bda3c last_write_checksum: sha1:b9a3466f5bf5ac9168f8b5467d81fadc4de9adf4 @@ -9514,6 +9906,14 @@ trackedFiles: id: d6cf424d34cd last_write_checksum: sha1:1489fd1633446cf2031ff3ba0fb6c5c14ec312ae pristine_git_object: d381ae8b7717f91b9d15143da5617fccef68aacf + docs/operations/deletebudgetpolicyglobals.mdx: + id: 19261d8d0005 + last_write_checksum: sha1:3205899f7227b444add9361874ca117f76a1e44e + pristine_git_object: 113dc43f77d47e7bc73a463bc9781916e59cfb5e + docs/operations/deletebudgetpolicyrequest.mdx: + id: 2c45c97a631b + last_write_checksum: sha1:1b1cfc73b37d44ad91cc3f22deddd733dded0dab + pristine_git_object: 44e320de48da9dabc308c895968c6587ef0fd616 docs/operations/deletebyokkeyglobals.mdx: id: dd77cb8066bd last_write_checksum: sha1:4e20791ebaabc8603037484a05b5951001d58120 @@ -9566,6 +9966,22 @@ trackedFiles: id: 1bfa5cbb0a5c last_write_checksum: sha1:2d1694347091117767eca105dfa7188c2b40b62a pristine_git_object: fef65fc6e834515166cb3d59d5063495624ff3d4 + docs/operations/deletemodelavailabilitypolicyglobals.mdx: + id: 1bb2fe6e35b1 + last_write_checksum: sha1:f734ec916f8c588b1b49460a5cbaaffe8b203a85 + pristine_git_object: dd70a9037b4d47ad83fd63b1b060d3db7f7b4718 + docs/operations/deletemodelavailabilitypolicyrequest.mdx: + id: f0c18f153d72 + last_write_checksum: sha1:ef227050bb64816b23203f0258b61dec7e26fce9 + pristine_git_object: a86e140f85e9aca8ec3bb3b7c93d8a4e9d5425ab + docs/operations/deletemoderationpolicyglobals.mdx: + id: 15cd90bb4410 + last_write_checksum: sha1:7b32dec1c2dfb133ff60f34636e235410a0265dc + pristine_git_object: ce3ac45b69a46bbcaad29f07440eba97257e4836 + docs/operations/deletemoderationpolicyrequest.mdx: + id: 085c50549aba + last_write_checksum: sha1:566bbe59b5c16c6546256d0545a9f447e389185e + pristine_git_object: 8532fcc7495a8c0f33fde2c6281d2d27c00e1c55 docs/operations/deleteobservabilitydestinationglobals.mdx: id: c76d2f794054 last_write_checksum: sha1:02f08cd5ab9f563783cc4f76e29f99c29d2a1ab9 @@ -9742,6 +10158,18 @@ trackedFiles: id: 79b7e7689e40 last_write_checksum: sha1:87f5c70ba6b578c7628153c5fc825b5753ed0a5e pristine_git_object: d956bbd759da563e94340530a25cb4ce4b0f92a3 + docs/operations/getapikeypolicyassignmentglobals.mdx: + id: b800204983b8 + last_write_checksum: sha1:a9ecfab535dc0184c8e37341b35f09464c462f09 + pristine_git_object: f121aa621a1f904558a33f1150b750a37a0bce23 + docs/operations/getapikeypolicyassignmentpolicytype.mdx: + id: 5df18d0bbbd6 + last_write_checksum: sha1:7ab2dc08e7c5bdf0187290e754086a8d9c926991 + pristine_git_object: aefef6cbce3c5817aa2d7358d9f27f52758ea1f9 + docs/operations/getapikeypolicyassignmentrequest.mdx: + id: 6c6b7de2c3e6 + last_write_checksum: sha1:d2888f3e766ae9777bdd3cdf2b25bbaab9092b09 + pristine_git_object: 7a431538dc6e09016c695440a3dffd15d5b8ca54 docs/operations/getapprankingscategory.mdx: id: f533cbc2f61c last_write_checksum: sha1:dddef3ed7370f63a996d8201282702598ba3823d @@ -9778,6 +10206,14 @@ trackedFiles: id: 704fb5d64a7c last_write_checksum: sha1:06f374dd4e87544721728de4edeac020c814edbc pristine_git_object: ab720f00c82b746a7c41895e187a617b2d5d6101 + docs/operations/getbudgetpolicyglobals.mdx: + id: 1fd05a15603a + last_write_checksum: sha1:042ba8a33b8116004832b9f96785dd49e21a2995 + pristine_git_object: 11aa46f63c7bd56476d53367637914ecdbfdd6c2 + docs/operations/getbudgetpolicyrequest.mdx: + id: 6299723c20f0 + last_write_checksum: sha1:5a82b025b442889cd8a70800f2392481ed0561e7 + pristine_git_object: 53da1b872040d26a997ed299a152d8de444b8188 docs/operations/getbyokkeyglobals.mdx: id: ac592fd40012 last_write_checksum: sha1:105293ad014a98662b974036943224241d10b538 @@ -9874,6 +10310,26 @@ trackedFiles: id: dd773bd25661 last_write_checksum: sha1:bbfeaf2fc813f60f1ca490b8d09679c10e64ffaf pristine_git_object: 4f5f35a2b8fda85919b260f54de213b6702423ec + docs/operations/getmemberpolicyassignmentglobals.mdx: + id: c9b1b164b494 + last_write_checksum: sha1:ef6a3b80781308ca0805f5a9517a7937f47386f2 + pristine_git_object: bbd9115cd5f46c61058f4677467de27a35fbe9de + docs/operations/getmemberpolicyassignmentpolicytype.mdx: + id: 78fec48fd5d2 + last_write_checksum: sha1:245e228c11bc7b6af01afe67814e7e8d38b9bb50 + pristine_git_object: 8f1249a1c51f3985c6500c61e7ad099b3e86740c + docs/operations/getmemberpolicyassignmentrequest.mdx: + id: cb85e9c92abf + last_write_checksum: sha1:0f17f7471ed16b3f3abcb1633f103fadf4f07910 + pristine_git_object: dee837e8ce990675b0c4e1505d5f9e9d60e83c53 + docs/operations/getmodelavailabilitypolicyglobals.mdx: + id: f44e22466764 + last_write_checksum: sha1:536f206e900238aecd1ac9b6b063df383b72091b + pristine_git_object: c7180967b0b965bbd46b8564411c9b6197770336 + docs/operations/getmodelavailabilitypolicyrequest.mdx: + id: 14a82b0a3939 + last_write_checksum: sha1:b9097a91b35f713ee591c222dc7c5d16a601217e + pristine_git_object: 77afcf905dfc9cc0a00dda260089d6992adaf248 docs/operations/getmodelglobals.mdx: id: 18648d7998ae last_write_checksum: sha1:0efec4790215ca9fc19813432cc224cdfaf73215 @@ -9902,6 +10358,14 @@ trackedFiles: id: 3cfd33e60661 last_write_checksum: sha1:6d75758523f8665ff617fe5d4e54385ad785c7ef pristine_git_object: 537a70d3eb590cda229847689553607b46a3a5f7 + docs/operations/getmoderationpolicyglobals.mdx: + id: ba912e4f7927 + last_write_checksum: sha1:d00889f156ee52fea3c86ad2b73a9c578aaca4b9 + pristine_git_object: 9ed605c3de987398bce22918d0a374f021a91159 + docs/operations/getmoderationpolicyrequest.mdx: + id: 55b9548807b9 + last_write_checksum: sha1:cda42b1c8f3b9f6efc4625e9c07390118a6bb38d + pristine_git_object: 002e39ad622b0cd342d59c71430eb017e2345378 docs/operations/getobservabilitydestinationglobals.mdx: id: d7ba84a5b9dc last_write_checksum: sha1:5ee778a89cb0c0ebd9245524aa55bc432f3aebfc @@ -10090,6 +10554,18 @@ trackedFiles: id: fe52912b0ea7 last_write_checksum: sha1:85897c7620d5c3725f610a496f4ceb485b9f5063 pristine_git_object: 0d94d66d51eee4f9fc8d18fb42a32c91fb9c89ec + docs/operations/listaccountpoliciesglobals.mdx: + id: 4d11760c1775 + last_write_checksum: sha1:e5c2749329e56762911ac6154f283977c0a9ee1c + pristine_git_object: 8f0ad2375f4ae972a97adcc0ba36f56a7c7b8954 + docs/operations/listaccountpoliciesrequest.mdx: + id: 6218422b5f8c + last_write_checksum: sha1:b3a3217055beef2120f375627c77b867989414f7 + pristine_git_object: b559f12e72f215e91759849b3044edd13654cef0 + docs/operations/listaccountpoliciesresponse.mdx: + id: 12c38fc11a9e + last_write_checksum: sha1:ca108525b59e6ebcd1746f69092facb6d773a57e + pristine_git_object: 259391ed6eaa7be4eea86e18793295e69e35aa62 docs/operations/listbatchesglobals.mdx: id: dbed29868962 last_write_checksum: sha1:50cded70fe30b2c0da4bbb8dee456e793e023a6a @@ -10102,6 +10578,18 @@ trackedFiles: id: dccadaeb9c73 last_write_checksum: sha1:ef2a4d2168ceb7595ac6e6b9744fc31754ff18f3 pristine_git_object: 3635e44e2532049129e188b1534a78de0b998af4 + docs/operations/listbudgetpoliciesglobals.mdx: + id: ef76f84ea2cd + last_write_checksum: sha1:849d8c5dd2fce2d54b7c8bda69734bb4affe166c + pristine_git_object: b63e94c1de6221afb02f64079b1e0595cd8b1f2f + docs/operations/listbudgetpoliciesrequest.mdx: + id: aeb3d4ba7eab + last_write_checksum: sha1:6f257860ba984d459fee4ab1a7e773d5b8c1b832 + pristine_git_object: 27212a740dc2e4809bab7c3aa1fe10e102aa54be + docs/operations/listbudgetpoliciesresponse.mdx: + id: 8104180b185d + last_write_checksum: sha1:ec29f6d2d8dbe76e6e1cf6cf13e4c7eebfe1e4dc + pristine_git_object: 2c5031e57bcb368db40e2b8944ec0651cbc928ca docs/operations/listbyokkeysglobals.mdx: id: b77dfe46caab last_write_checksum: sha1:6c1fdb9100a919dd4dab9333d07c202aafb66291 @@ -10306,6 +10794,18 @@ trackedFiles: id: ec7bd9eaadcf last_write_checksum: sha1:112593b762bb415fc377a2dbb77d7ad8779737e1 pristine_git_object: 5e148c99b9db6afeb748ad518231da6102480f73 + docs/operations/listmodelavailabilitypoliciesglobals.mdx: + id: 89e6d04de4df + last_write_checksum: sha1:6f55c828ec45e21ac0b8d8da886a488bea53c832 + pristine_git_object: f13ee104f069696c2138d28ae04b3dc4933c7e0e + docs/operations/listmodelavailabilitypoliciesrequest.mdx: + id: 02796595a709 + last_write_checksum: sha1:6bf86b2fa20459e0dd66617eed6ffd5582a36775 + pristine_git_object: 7158e2ca1a9b317feb14aff7ac5b333f4819983a + docs/operations/listmodelavailabilitypoliciesresponse.mdx: + id: c2f14936c042 + last_write_checksum: sha1:3667f4a49b3213bf224c28c12d032e47ad370558 + pristine_git_object: 084096dba5ccfe555287a39957ef883c052caa44 docs/operations/listmodelscountglobals.mdx: id: 53a4fd1bcaa0 last_write_checksum: sha1:b7c998a25c6c0e3893f246264bdf3ddb506b6ea8 @@ -10334,6 +10834,18 @@ trackedFiles: id: a6cd738b2b05 last_write_checksum: sha1:fbe3a59ea629b15942d1aeadde96f46a51f29a66 pristine_git_object: 4bae293ec5d0a8b931bb85c6df53316562c66fee + docs/operations/listmoderationpoliciesglobals.mdx: + id: 9696f0898918 + last_write_checksum: sha1:81f4f38601d5ac6cbf0ebfd33e4b1a3b2b0211d3 + pristine_git_object: 294535c4431d4e69f893130b756c1041d9e0c4fc + docs/operations/listmoderationpoliciesrequest.mdx: + id: 1b72b699ef4f + last_write_checksum: sha1:8d96ca2d2b04a6dd6436e5b529f6125918403834 + pristine_git_object: 9de40c8054c690a5d3750fe3a320a2e3286e71ac + docs/operations/listmoderationpoliciesresponse.mdx: + id: e59e14a9d948 + last_write_checksum: sha1:eb5a272f2be7a0ddb4d6aee6ee83bf32c749eac1 + pristine_git_object: a1ff97761dafbe089fdf7a50b77d48416312b0e2 docs/operations/listoauthjwksglobals.mdx: id: 7fe931762b70 last_write_checksum: sha1:1e4e411b6dc9eb5c51f43c9dcde8c00de625d16c @@ -10706,6 +11218,22 @@ trackedFiles: id: 1028e314e662 last_write_checksum: sha1:21a2b31e9c9c12e1f1ea477ef497998cd4982b05 pristine_git_object: 7f1519173ad9246262a680667ec1b2286e15e778 + docs/operations/updateaccountpolicyglobals.mdx: + id: 001510b3b685 + last_write_checksum: sha1:d7c2e94a6ef112d70b0b4671dc57a49e50b052d1 + pristine_git_object: e308c55918ff589cce5fe036a894b636cec9df9f + docs/operations/updateaccountpolicyrequest.mdx: + id: 2062948078c9 + last_write_checksum: sha1:b619095c7a677c8397e270565117b975628117ef + pristine_git_object: 3b6e63857acfcff716a6fd795bf186c26010cf6f + docs/operations/updatebudgetpolicyglobals.mdx: + id: c6edd055998f + last_write_checksum: sha1:f22eb784954099f6e922b599cdd6c748180deabf + pristine_git_object: bcc2a3a9289a1cb6d7193cf0985c923c4a8decb8 + docs/operations/updatebudgetpolicyrequest.mdx: + id: 23e39a67b746 + last_write_checksum: sha1:5d5e11af484ddd96d1da53a078b6c79f538acf5a + pristine_git_object: 79634dbcce58f6c5302ca98e3826c33b060ea08b docs/operations/updatebyokkeyglobals.mdx: id: 5d2a09eb8596 last_write_checksum: sha1:d3b90a59dee06cb169881fbea15eebb2c6b2105c @@ -10754,6 +11282,22 @@ trackedFiles: id: a97d51fea627 last_write_checksum: sha1:44631562c5f1edb827ac0f66d9b2b6974bcab417 pristine_git_object: b644f9bd39777883f9d80ae02a7b4f5398d2338f + docs/operations/updatemodelavailabilitypolicyglobals.mdx: + id: d5fcd05c75fe + last_write_checksum: sha1:af82a2a32ff586c5415bfd4b9a4304ff47d949cd + pristine_git_object: c7fd5068ac06cffe6ca67b9deb1de43000ab5fe6 + docs/operations/updatemodelavailabilitypolicyrequest.mdx: + id: afd4fb1eafd6 + last_write_checksum: sha1:b1e3332740d65a89c600b0357370f07f6ad41117 + pristine_git_object: 8b1ef9b4bccd0461b904c0bbe935b8259ea6585d + docs/operations/updatemoderationpolicyglobals.mdx: + id: ea2c53378156 + last_write_checksum: sha1:7340ffd37c0f303b9da1c8a5acbf69960b94d958 + pristine_git_object: bb19d5d04b86f2fbdede6a2bfa3dcfb51a2f7a88 + docs/operations/updatemoderationpolicyrequest.mdx: + id: 44213885815b + last_write_checksum: sha1:eae631d51ac4d0c1895ef2809dbe33230af30cd9 + pristine_git_object: 83b9a8f6bd0e0bf3ee59b40df76d28bfb8a47737 docs/operations/updateobservabilitydestinationglobals.mdx: id: f85617547bfa last_write_checksum: sha1:d52f727e6845d1c717645ef90d81f03b146e5cef @@ -10926,6 +11470,10 @@ trackedFiles: id: a754fecc8514 last_write_checksum: sha1:2eca85f04582e3f466e7f9a72eccad6d004301f1 pristine_git_object: 620461d10a770f6ef9df53ef054775bf0df7ac1f + docs/sdks/guardrailpolicies/README.mdx: + id: 0e5ed6ce5965 + last_write_checksum: sha1:2e1457d9e610551d1cf723858696637a3026faaa + pristine_git_object: 0fa8a42f96cb4f234775f8bb07f8d985eb041bc3 docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa last_write_checksum: sha1:d7e1c765f925bb303b9585638075e1ef44d617fa @@ -11012,8 +11560,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:ddf3436a53d9ced3db7db5e63b0195f1d67a09b0 - pristine_git_object: 326597ffe04f2ab8bcd91c8164128eeef3acc969 + last_write_checksum: sha1:561c6767be55ec00414b083a9770c1019ce9e1b9 + pristine_git_object: 8e0cd00d3bf5043c3834bd1626f2f25318a3997f scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11040,8 +11588,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:81469ff054eae539eb5d2bd9ef2ec462ba5f9b17 - pristine_git_object: 4c8151ae024627c7c683ab46a866d3893b3d0efe + last_write_checksum: sha1:7b1362315ea0b04dcbc29770d30d9c622d664275 + pristine_git_object: dbc0718671295b361bcebf663f0d8d2e6372db93 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -11088,12 +11636,24 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:55d085d620a8c153c5f4312243dde6a849e1bc21 - pristine_git_object: 8cc06bc4ade52a6aaa22ba0f768eb9d2bf4dbabb + last_write_checksum: sha1:41368ba38a9a07f48992136b74214ae7fe2949bc + pristine_git_object: e02bf331a2bd0026ae9cfe4dce27099db6eda3bf src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c pristine_git_object: ad39bd9765938465f06b5422706fc867db11e468 + src/openrouter/components/accountguardrailpolicy.py: + id: 280c4cb634e8 + last_write_checksum: sha1:397d865dd94f366abac85d10e5bffca666050c78 + pristine_git_object: ba9e3ea0c518f0fe44e0258e85116cebd2822acd + src/openrouter/components/accountguardrailpolicyrequest.py: + id: cb144cda274b + last_write_checksum: sha1:6c641c69f3a32758a1c3f87b00a4b6d5df93306a + pristine_git_object: 48bf26eb4e3984470729637d5779bf9e6ceefe69 + src/openrouter/components/accountguardrailpolicyresponse.py: + id: a4fd73da01cf + last_write_checksum: sha1:da984ec882bb396700109fe239eb98ef8037d8a1 + pristine_git_object: c8ad7b1689387bad084d1656e36ae09b4d739e45 src/openrouter/components/activityitem.py: id: 3bbe7d35f459 last_write_checksum: sha1:ad3ecdeb41d51f3e1698f0828df6cf2eca94d72d @@ -11668,8 +12228,8 @@ trackedFiles: pristine_git_object: fcc6d267178e9f01f1faef96854a1cc3bf40ff02 src/openrouter/components/armorplugin.py: id: f3ea1534eb32 - last_write_checksum: sha1:bb4a0aa6f8ccebcdc45d5fabec8e4c2014b57189 - pristine_git_object: 4ce09db97abadf52e70a4280202ef2414a1a2047 + last_write_checksum: sha1:cc76f3ec0a9e8406116bced9509722c87034148e + pristine_git_object: 1af8677573d3ba2e81bd22dbd3ec0ba665359eeb src/openrouter/components/armorrule.py: id: c8005fb10846 last_write_checksum: sha1:58fe830186d915730ff8acb8a124378a13a7272f @@ -11766,6 +12326,34 @@ trackedFiles: id: 6009fd660c03 last_write_checksum: sha1:2615f4f9eecdf753ece20adc9897553404c71cc1 pristine_git_object: 75d5ed893814b2af7bd59a0f4729ecbcd701bf6b + src/openrouter/components/budgetaccountguardrailpolicy.py: + id: f6f631254ea2 + last_write_checksum: sha1:1fd977423aff08ea8fc1243300491748fff562f6 + pristine_git_object: cf6ac52ce58176633af1c9376ed215e57b0da36d + src/openrouter/components/budgetaccountguardrailpolicyrequest.py: + id: ef5c94ece073 + last_write_checksum: sha1:199676b87d1745e2795cb3e860e958bf692ecd88 + pristine_git_object: 384e0fcee6ddf4f55f5c8001b6ed2f3e7d860578 + src/openrouter/components/budgetguardrailpolicy.py: + id: c8f5fa878d44 + last_write_checksum: sha1:eb6108979b43aa3fa473980c04753517a122c9a3 + pristine_git_object: 40183ab5b9ebc8859276b4cb4781f66cf4eb955f + src/openrouter/components/budgetguardrailpolicydetail.py: + id: bce74e87fc16 + last_write_checksum: sha1:ce05b261609ef71d099ba6860e734a0aaed3623e + pristine_git_object: 671bdcfb2c135e61228b22b4945fb4923f21b201 + src/openrouter/components/budgetguardrailpolicydetailresponse.py: + id: bd20ecb3447c + last_write_checksum: sha1:b75836972ea14d84dcd5bb9da923d91c070edc65 + pristine_git_object: f6c79b45f5d56f88bdc967aba043a60562d56733 + src/openrouter/components/budgetguardrailpolicyresponse.py: + id: 7ac38f52a75c + last_write_checksum: sha1:8ce84ffbbc988e838f23b12006e1d7dc2a8f17b5 + pristine_git_object: 36d61a64b42eada3ce4c767979e58994e4e8f59f + src/openrouter/components/budgetguardrailpolicysummary.py: + id: 9fc44b1f6fee + last_write_checksum: sha1:c7fed0a3f56995cd3d10757284d3aade980d66a9 + pristine_git_object: c6867d59086428b6b7e1c90c87ce5b370834e4cd src/openrouter/components/bulkaddworkspacemembersrequest.py: id: c042d4bce938 last_write_checksum: sha1:dd5b69cce65985231a77351be04aadeecc85c46c @@ -11826,6 +12414,14 @@ trackedFiles: id: 368790a86f10 last_write_checksum: sha1:a167551924ee82b4b5876a0ab698a45fe8c87a95 pristine_git_object: a1cb577d9835d93914b06761e2cad3ceae2961e2 + src/openrouter/components/changeguardrailpolicyassignmentrequest.py: + id: e74dfdf48a81 + last_write_checksum: sha1:540e746feb9d8cbfe48b378d3ac5ce665b4fd375 + pristine_git_object: 27381f63769c36e2dbeb6c86df3788849a33ce6b + src/openrouter/components/changeguardrailpolicyassignmentresponse.py: + id: 8ea6504bed9d + last_write_checksum: sha1:5b15572ac8f586bf9a3e2c806f196edb02ded7a9 + pristine_git_object: bb4e21fc493e4eca2ffa92791958d6252d40bec2 src/openrouter/components/chatassistantimages.py: id: 993f9dcd8575 last_write_checksum: sha1:0b6be31bb9c8b3bc8f2098af5b2bd12b62a710bb @@ -12194,6 +12790,10 @@ trackedFiles: id: 513b4309de6e last_write_checksum: sha1:86be7d0f74dc9f95fff4dbafed62541a353a0e8b pristine_git_object: 15b66bb18088bd61cccfa17e1cb5ef26c02abc84 + src/openrouter/components/createbudgetguardrailpolicyrequest.py: + id: 8fc88141b2b2 + last_write_checksum: sha1:52cd45cffdcadc4a3a3c8b1d4b9589d51d3e9ea1 + pristine_git_object: 57c04236f445d54cec57bc07a886822e35f494cb src/openrouter/components/createbyokkeyrequest.py: id: 238e868445b4 last_write_checksum: sha1:2ab5ff2c5b0b9400723d41d4fa4dbdffd8b0b8ae @@ -12214,6 +12814,14 @@ trackedFiles: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 pristine_git_object: d6c4a4dc73222668daddc2a1788d314ff30e8fe6 + src/openrouter/components/createmodelavailabilityguardrailpolicyrequest.py: + id: caedf451c860 + last_write_checksum: sha1:93e71da8dc1a93f3f6120f8104723928225a34e4 + pristine_git_object: a5935ebd04a7359a275257ff9a8943f38139e4a6 + src/openrouter/components/createmoderationguardrailpolicyrequest.py: + id: 6ceafafe2ebc + last_write_checksum: sha1:dc90bb657cd1359d864ab4e5d597ae9dd388a970 + pristine_git_object: 0266b86d75b79dca3c8d55889824ad60b277834d src/openrouter/components/createobservabilitydestinationrequest.py: id: 58587fb98a32 last_write_checksum: sha1:f956b75a335301856e16a244d7bd463397688057 @@ -12386,6 +12994,10 @@ trackedFiles: id: f9a1e677521f last_write_checksum: sha1:371aa071eb7da7c466521eed203e32e441c6abb3 pristine_git_object: 3e3a7de0f0b5ad0657df890e2764c4437f0357e5 + src/openrouter/components/deleteguardrailpolicyresponse.py: + id: 26dcc09f6891 + last_write_checksum: sha1:07ca4f9dd1e342dda0310f9bfea168b5ba41bd6f + pristine_git_object: 3a3f76019931815f422e9bc58f46e58160b56575 src/openrouter/components/deleteguardrailresponse.py: id: c3ac908331ef last_write_checksum: sha1:6a5ca367dfad148ce7f01d14044efbef37b36d2b @@ -12770,6 +13382,14 @@ trackedFiles: id: 67ee78dd06e6 last_write_checksum: sha1:246d44cd9b211dcd23614df71505b79b2677125a pristine_git_object: 252b329019216d0cc8d4c7568edfc0d9c91968fe + src/openrouter/components/guardrailbudgetpolicyauthoringconfig.py: + id: 3011896fdeb5 + last_write_checksum: sha1:604d6ec6906a391e0ce81e315ec077ab17e081a9 + pristine_git_object: 2337e2fe000e12ad5c187f1666926b32abb41199 + src/openrouter/components/guardrailbudgetpolicyconfig.py: + id: 13d0e65aeceb + last_write_checksum: sha1:81e4bdaa79bfcf6738b53f0e86a03d0f39ae1780 + pristine_git_object: d7904915e9f5ac069c2707f7102379dd8d06e10b src/openrouter/components/guardraildataregion.py: id: 16c31f1446b2 last_write_checksum: sha1:52b5622a7c93a30219108f033ab0e3fbb3a396f7 @@ -12778,6 +13398,26 @@ trackedFiles: id: 01687fc135ab last_write_checksum: sha1:430f886f371b85777346de663202d62708cd84cf pristine_git_object: 9cdf08ab3c380a8ea69b5884bcd40a09464589c6 + src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py: + id: aa89978d2e99 + last_write_checksum: sha1:2236d0754f0c24b49c2c1d7ae5bbbe6d188c3499 + pristine_git_object: 55d1ed146536f0e823152b37aee8b249162c9019 + src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py: + id: 3db2ab65ee94 + last_write_checksum: sha1:76cec560945e4a0177fe3eebd6e26c84dc96f430 + pristine_git_object: cb19bac25652cc91f0c85479e58c6717357a1057 + src/openrouter/components/guardrailmoderationpolicyconfig.py: + id: 95252e545b13 + last_write_checksum: sha1:a4f271e2e056520301737a25ee9072bb6b7e3e42 + pristine_git_object: 31492614603ec070a66797c60c531ca4cda4046a + src/openrouter/components/guardrailpolicyassignmentresponse.py: + id: 683f03ecd6a5 + last_write_checksum: sha1:7755ec4f8743f98407647c5899c5ccdf76b9f6a5 + pristine_git_object: 10c97f04097936363270366d9663e05046e37f0e + src/openrouter/components/guardrailpolicyassignmentstate.py: + id: 83d5f63a54d4 + last_write_checksum: sha1:9097aa89b2df7b7b26c352b4bbc57515554ccb7f + pristine_git_object: 4b8ecd29e1c4b4956e907730e5dce7efb4de396b src/openrouter/components/imageconfig.py: id: 674f6eca2929 last_write_checksum: sha1:184975ccbb32091fb1c60723c6bbb3abb51d11bd @@ -12966,6 +13606,14 @@ trackedFiles: id: 8b28b05b8756 last_write_checksum: sha1:83ee6cf9b98e96d8d68d8958d51abed82de3379a pristine_git_object: 99fc8b6e5ba46d2605c258bc954d67a282420b63 + src/openrouter/components/listaccountguardrailpoliciesresponse.py: + id: 2312eeb35784 + last_write_checksum: sha1:d23a6212a03a9635bd1319c0ce35e5f2757af379 + pristine_git_object: 72b56dcf6fc9203351d12a0d55284a2ffe2408e2 + src/openrouter/components/listbudgetguardrailpoliciesresponse.py: + id: 2b679ad805f4 + last_write_checksum: sha1:e1c901831648e4c2b54ce3ab7f5a1415cb890865 + pristine_git_object: 305ff8281a0d761a773f8e745fd3d3f5e41266b9 src/openrouter/components/listbyokkeysresponse.py: id: d5f63cba5dd9 last_write_checksum: sha1:97cd54e94ba4996ebb43252ac31aa70511e0328c @@ -12990,6 +13638,14 @@ trackedFiles: id: 78ca80afcc6f last_write_checksum: sha1:3edda0c8ff111abaf5332475d89a87e84f4f5d78 pristine_git_object: 1497ba3814f2f058c1332d8bcf92a2e2bbed0fe5 + src/openrouter/components/listmodelavailabilityguardrailpoliciesresponse.py: + id: 53843b824448 + last_write_checksum: sha1:826d3e08425b9982ccc9b8ecd7ec3805925dc75f + pristine_git_object: aeb2e0b4bd293ae41d3e810d591f6e0ee4705f26 + src/openrouter/components/listmoderationguardrailpoliciesresponse.py: + id: 13485dba77f3 + last_write_checksum: sha1:bff9e98b50d4315ef81eb4155f994c8c56e0f525 + pristine_git_object: 0c4a382abbd28a25fc61853b986734cc93c50751 src/openrouter/components/listobservabilitydestinationsresponse.py: id: 3752b99f5e22 last_write_checksum: sha1:34fd7efbbf22fb9004737ab0fea34881b4cce554 @@ -13182,6 +13838,34 @@ trackedFiles: id: b37ac27e512b last_write_checksum: sha1:d0b370e5a88cb723c8836ba4c5f4bf9c000ff82d pristine_git_object: b1fb080a8142fe434784811e7c1cd51fce87c0b4 + src/openrouter/components/modelavailabilityaccountguardrailpolicy.py: + id: 94b7d76cf6f1 + last_write_checksum: sha1:48869ec23df437b532a582b499a447c0331fa4a1 + pristine_git_object: e0c22fdd794fcc47a52b8ff7c43c0a77a40fc961 + src/openrouter/components/modelavailabilityaccountguardrailpolicyrequest.py: + id: b2f5da47c8dd + last_write_checksum: sha1:a8e55b4c16facbadebebeadaaa3f4bba1aa6bea7 + pristine_git_object: b862e26705adf7adc493c48d8b0a2d1b7056c08a + src/openrouter/components/modelavailabilityguardrailpolicy.py: + id: e1b39fa335de + last_write_checksum: sha1:e8e7e10a09156133fa9a8adbfa2080302fc99389 + pristine_git_object: 1f95f9bd06b94721cd9894640056f22286791b30 + src/openrouter/components/modelavailabilityguardrailpolicydetail.py: + id: 6ab89ff04f58 + last_write_checksum: sha1:0aaa24e194ef637670db6bb0bc5cbad210d20ea4 + pristine_git_object: ceaf2f735bfbc7e16bfbd80a79f3cada817b36f2 + src/openrouter/components/modelavailabilityguardrailpolicydetailresponse.py: + id: 8d6d133ab5ed + last_write_checksum: sha1:fd24c3e5e70f78ef21051c70638b80dcfa968437 + pristine_git_object: 0bbae3d3ed96045918af46661af20ecf3f096377 + src/openrouter/components/modelavailabilityguardrailpolicyresponse.py: + id: f88f3b48db7b + last_write_checksum: sha1:b28d5666f225b7835afddb120d922769ac6def04 + pristine_git_object: 848445a169e110e57b2d9a26fb1e835119c305bf + src/openrouter/components/modelavailabilityguardrailpolicysummary.py: + id: c4c6915c98f6 + last_write_checksum: sha1:942c7ca618bc38ff50f4db8ad86e119328d737a3 + pristine_git_object: b711944d157ac79e84abab12ebc4a37ac03c3400 src/openrouter/components/modelbenchmarks.py: id: efd0b01b6775 last_write_checksum: sha1:71dd3f1be37b6ea21345316025cb106488a9a4c9 @@ -13210,6 +13894,34 @@ trackedFiles: id: c2d4bb2cac89 last_write_checksum: sha1:7aed32b04707f657a8e09d6897efeb9e8800d21c pristine_git_object: c767f01a74dfd6bee9f6fdeab9c7c7ce26bea6a4 + src/openrouter/components/moderationaccountguardrailpolicy.py: + id: a4ada1a66e21 + last_write_checksum: sha1:0a2f97a64a8da2ea28de13c9d7e339a5c588d72a + pristine_git_object: 7ad79ba04985e3e267a30bd43ae511aaa173406f + src/openrouter/components/moderationaccountguardrailpolicyrequest.py: + id: 263b7a7af688 + last_write_checksum: sha1:3505cfa0cd4dbb5204a40846b495f40d99e92867 + pristine_git_object: 49d6516ab802d82191acc15d4240fff0c91ba011 + src/openrouter/components/moderationguardrailpolicy.py: + id: b898286082e8 + last_write_checksum: sha1:25d86fe7495d3ed8c57916e79c975d1f7b0a9f30 + pristine_git_object: e6295657086e5282ef13e659d7650a09d2ad94d5 + src/openrouter/components/moderationguardrailpolicydetail.py: + id: 9be65db865a1 + last_write_checksum: sha1:a463095ef589a364dc65b4992fea43f6c0046951 + pristine_git_object: 2a1b8b5ec112d7e2c4a96629394243c90d95745d + src/openrouter/components/moderationguardrailpolicydetailresponse.py: + id: ae5b73350bc3 + last_write_checksum: sha1:cadea30a011984e5abb2ca21cb18d3437a2b2dea + pristine_git_object: 48dc8f34098cecc2108cf8faa54feab11dadcb98 + src/openrouter/components/moderationguardrailpolicyresponse.py: + id: 47905db9f29e + last_write_checksum: sha1:24586d6fb891d91e28a77f5f1d5daccc816ec096 + pristine_git_object: 391e85d168e5432f35d8063fd12018b29c8d89e4 + src/openrouter/components/moderationguardrailpolicysummary.py: + id: d105ea9e30a6 + last_write_checksum: sha1:c97d4e84a98e488121ac7bacf7766dd8fc68c11d + pristine_git_object: 666cae30585f452507dbcfdcb40f80cc09fa5ea1 src/openrouter/components/moderationplugin.py: id: d99bd9d505d3 last_write_checksum: sha1:58ff3e6829b973b3db5ed7dda3fa11558ded04b2 @@ -13596,8 +14308,8 @@ trackedFiles: pristine_git_object: 90625cac6f95fc7d0ba3b470e695058e4977451a src/openrouter/components/outputmemoryservertoolitem.py: id: 4b0dc2fc5f41 - last_write_checksum: sha1:9f0e9de9562aa7b0909ff7724bf0c5f4ccac7beb - pristine_git_object: 775551b0a4f71bf2f19b3b26bf1f0d3cc0fd80d9 + last_write_checksum: sha1:f11297483b5ccfc3cf6212d07016164d7582333d + pristine_git_object: e542eaeab3b736d4b8dd5c3f8d26f3d55a34971c src/openrouter/components/outputmessage.py: id: c6828e87dbd3 last_write_checksum: sha1:9472dfda50fb46afd2508364e421fe0dba62729c @@ -14482,6 +15194,10 @@ trackedFiles: id: e8ca4a51f994 last_write_checksum: sha1:e97c277b49f4bb6bcfad8eef8a46b382730729a0 pristine_git_object: 696d3c578c6b09f9768e52a7dd000284fb62f1b7 + src/openrouter/components/updatebudgetguardrailpolicyrequest.py: + id: 74e228d5233a + last_write_checksum: sha1:18b6d59609ba91b19a0950dc68d907d19126a122 + pristine_git_object: c85421a39da95e74a65a34d9988f49d50503983d src/openrouter/components/updatebyokkeyrequest.py: id: 5edad69c278d last_write_checksum: sha1:73b423be0e56559fcf91df831ff5c584ebca938a @@ -14502,6 +15218,14 @@ trackedFiles: id: 7b068d26ce31 last_write_checksum: sha1:2b63cbb90747f07f775d9a22e80f74c67221fea8 pristine_git_object: df833960211cc7ed2a2a42fddbeafda0092e1c0c + src/openrouter/components/updatemodelavailabilityguardrailpolicyrequest.py: + id: c91a629df056 + last_write_checksum: sha1:98dc29197df44bdd46296b263722509151e124b1 + pristine_git_object: 761d47a3b8acc1893a117dc2986d03ccdef70cde + src/openrouter/components/updatemoderationguardrailpolicyrequest.py: + id: 66bc0f230053 + last_write_checksum: sha1:db5be8422ada7321c69401ceb24aeb9f0cfb55b8 + pristine_git_object: ddfa0c4e3bf239603859762fe59a9b52d0b356ad src/openrouter/components/updateobservabilitydestinationrequest.py: id: d7a39fe04386 last_write_checksum: sha1:15ddb24dc0d5ed9b9757eb767426c0cc5a263f7e @@ -14870,6 +15594,10 @@ trackedFiles: id: 70e1c21042bc last_write_checksum: sha1:3be1e5755eebf249642df3b3638ad6a9556a3139 pristine_git_object: 8c989db92d681ffe9a956bae5c16c8f09f3627ca + src/openrouter/guardrail_policies.py: + id: 0505548eb66e + last_write_checksum: sha1:137cc46c93a5173f8125e43d99a2647cc6650714 + pristine_git_object: 9f5800f27db62a5159098c5cea96ed0dc312149d src/openrouter/guardrails.py: id: 705839f34e66 last_write_checksum: sha1:03183cc20b6c9f41b62b589ed6a6cb370ce50cc9 @@ -14908,8 +15636,8 @@ trackedFiles: pristine_git_object: 4a35ede011d09dddab042e2c00413ce4f6be655e src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:62969538c6bbd7a6bbf9509c09299d5f32e41304 - pristine_git_object: 6f0b96c552f725aa1e7660e7c0afdac1168291b3 + last_write_checksum: sha1:e487b8826ac4840df1c3649cb95d0209350ff7d0 + pristine_git_object: 488f95f3bafca987e61517199876475e61d2cd94 src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -14938,10 +15666,22 @@ trackedFiles: id: 8127aafae1ef last_write_checksum: sha1:7e1a34d0a1629bd6ed183a85b71a6897202a02bf pristine_git_object: ff2fc0c099bd5ade18b89e6d39698293ae65e87c + src/openrouter/operations/changeapikeypolicyassignment.py: + id: d51b3fed8944 + last_write_checksum: sha1:79b58a542c1e2fbbd07534aa5596e5d593e98ea3 + pristine_git_object: fd3bca20d51214bae07688a59b0332abc08bff3b + src/openrouter/operations/changememberpolicyassignment.py: + id: 21c52ff3e5e6 + last_write_checksum: sha1:40a62bf91b4a9a454fff499ab8c90ff95e8a67e7 + pristine_git_object: 87a88920e703863febeb89537f47287bbb573646 src/openrouter/operations/copyvaultsecretstointern.py: id: 79d33d578ed1 last_write_checksum: sha1:b72323ae345357ce1f4f21a7db77c7f96c2e9ad3 pristine_git_object: ea7d9a7e04d2b942a9a4c6ec6d6e8c96f41e6b79 + src/openrouter/operations/createaccountpolicy.py: + id: 3fe70d1faaaa + last_write_checksum: sha1:9d567ec41393b6c46d9ee10a1b95cc0e1ed38388 + pristine_git_object: bf40dd5e5e5eb17c6d7706a8e382f02163d3e155 src/openrouter/operations/createapialphadecisions.py: id: f685307a800b last_write_checksum: sha1:d92c222928d91f6b2e7f2b121084413e62573112 @@ -14970,6 +15710,10 @@ trackedFiles: id: 8b0681b22b32 last_write_checksum: sha1:4271449fca1c83d652bc54ebb9d2fc4528362868 pristine_git_object: b1bb2048a6530cf43194744f6bb4fa7769c04bf9 + src/openrouter/operations/createbudgetpolicy.py: + id: 27b24db74dc1 + last_write_checksum: sha1:5b8d3207412863e3701c8fadde846bc9ff375bf0 + pristine_git_object: e728e6e07506cd4f4df35bf2b1ed0dbc0ddfe057 src/openrouter/operations/createbyokkey.py: id: eaeefa9fe0c2 last_write_checksum: sha1:7e371b512bf4d80820881e0dc1868cb0861ae2ac @@ -14994,6 +15738,14 @@ trackedFiles: id: 64ad31fdaa6c last_write_checksum: sha1:97eab4df5a91777912ce61592c107ec2220bd1b7 pristine_git_object: 4b4164ca132bd16341c7d6f7fcb6106a30b24788 + src/openrouter/operations/createmodelavailabilitypolicy.py: + id: e37901457787 + last_write_checksum: sha1:2f023f2efe62eefdbf440cc1e220dd762868bdd6 + pristine_git_object: 63ffd7729dcf73b43278740d8a9a2255fc45fcee + src/openrouter/operations/createmoderationpolicy.py: + id: 4180c1f464fa + last_write_checksum: sha1:4b2c559e3197dc9bff28e9181cf73cabd1fd0498 + pristine_git_object: 670af38e38965435bfbc80e7c78a77ff83db7c73 src/openrouter/operations/createoauthtoken.py: id: 02e1c061780d last_write_checksum: sha1:006884cfeeecfede1434f194460b7189cae89de1 @@ -15050,10 +15802,18 @@ trackedFiles: id: 690a809c4592 last_write_checksum: sha1:9fa9c78f3885742f76db1a54deefdfd192fc9c49 pristine_git_object: 15b96d1cdb7b54e4c9d14d443779be0b619b0e4a + src/openrouter/operations/deleteaccountpolicy.py: + id: 01fd63de0a77 + last_write_checksum: sha1:13a9ee6a3bb93af4e43712858787b10a484514e1 + pristine_git_object: 0228ab4585daedd72cb2dba4151636357800196a src/openrouter/operations/deletebatch.py: id: d91d01c99021 last_write_checksum: sha1:a79fb18f42fe2422b5ecca5362fc0c2172469b21 pristine_git_object: 9edaaae8038739d10a508b42a778447ba7ffc8d2 + src/openrouter/operations/deletebudgetpolicy.py: + id: 8263602af356 + last_write_checksum: sha1:be5e6767efb582dff05728c6d41228db4f0b9226 + pristine_git_object: 90fd1f9ef14a22dee2c55e9d1b5bfc5ec7635085 src/openrouter/operations/deletebyokkey.py: id: b1b2c6b06913 last_write_checksum: sha1:90aad5198d43e289d99c7b2eb66353de7593a68b @@ -15078,6 +15838,14 @@ trackedFiles: id: 0bd72d53b0a0 last_write_checksum: sha1:afcea9fd7d8e963f8a73c4f025b83bf6455dd45c pristine_git_object: 998021c4bbe713d9a81ebb79348e6f9e246964bc + src/openrouter/operations/deletemodelavailabilitypolicy.py: + id: 8193af92abdc + last_write_checksum: sha1:4b65c977e15126d6aa336adfb8b9d380c8d98c7c + pristine_git_object: 3827862e22c87a17a037631c7eaae49f3c92a556 + src/openrouter/operations/deletemoderationpolicy.py: + id: bc7c7773127a + last_write_checksum: sha1:82cc8a103c3084001faceb23b7d47c9af56ffc3d + pristine_git_object: 481cb406c438b657c5c54685743a9d81f0c3b43d src/openrouter/operations/deleteobservabilitydestination.py: id: efcdc4e7e19d last_write_checksum: sha1:975fb2edbcb96c6e890d1ed6ce2101ae261600d8 @@ -15130,6 +15898,10 @@ trackedFiles: id: 013673a37aa5 last_write_checksum: sha1:600dfdcb385f5116c32cdf6a6b53db925a1b6c72 pristine_git_object: d4b717427347a5183eff59d470945a183af4607d + src/openrouter/operations/getapikeypolicyassignment.py: + id: ad6711113aec + last_write_checksum: sha1:119c722522881ee2b8eba8a2312ac38910873362 + pristine_git_object: 7b87d4d5493916a11c65464116c1eaafb530f6af src/openrouter/operations/getapprankings.py: id: 5ffd23dafcc1 last_write_checksum: sha1:ab86de57d9c8502a130a61f4405f3ca40c2ff5dc @@ -15142,6 +15914,10 @@ trackedFiles: id: 5fb88644491e last_write_checksum: sha1:c059365dfa135f5d6d929464c06af3421cf89c62 pristine_git_object: 51f1f39f8f61ebb2edc9770ad79e09bd7886fd2d + src/openrouter/operations/getbudgetpolicy.py: + id: e17092f50a72 + last_write_checksum: sha1:e3ce8b4931dea448df38b4b5a852870c4c85445c + pristine_git_object: 5d830347d5af127d76735e23e15af88860bb195d src/openrouter/operations/getbyokkey.py: id: d141452bd88a last_write_checksum: sha1:d6d391b230d90f51945144e63e9c53772650bd7b @@ -15178,14 +15954,26 @@ trackedFiles: id: d9769da90865 last_write_checksum: sha1:63a27034e350b578b6d5f29d6568111bc14c75c1 pristine_git_object: 924bb00ec6b3bcb57c9fb8442407b9c3ccc92b9d + src/openrouter/operations/getmemberpolicyassignment.py: + id: d2e2fd55dd30 + last_write_checksum: sha1:5082c311195fc27da06587e687b98471d377dd62 + pristine_git_object: c485047732f07103e69dd62196d9139f2cd26328 src/openrouter/operations/getmodel.py: id: 90c926cd726f last_write_checksum: sha1:3ba2f12410841c49e329821b8eaec5f87d5882c1 pristine_git_object: d5a47b01285b12f05d46240e253a934be63f0a00 + src/openrouter/operations/getmodelavailabilitypolicy.py: + id: 65d0a0dcfab6 + last_write_checksum: sha1:0b58c0763f995398f3142775bf35f9c5145e3986 + pristine_git_object: 5a3c822a888d653886c87328a0c8ce4fae7894d3 src/openrouter/operations/getmodels.py: id: 5bd5dfcb0125 last_write_checksum: sha1:ab0df91438a333015c3c7b8e6ef262c300f684a6 pristine_git_object: 51ad0ee78c5e47e0e42b1a2b12133467670402d4 + src/openrouter/operations/getmoderationpolicy.py: + id: 423190ca3bf3 + last_write_checksum: sha1:347d2fdb6c0040682881ab381c5dd8d1b6a40fc1 + pristine_git_object: 9e1e83005f4f97de02c81ac60a16ebadf894e687 src/openrouter/operations/getobservabilitydestination.py: id: 15b49f22aca9 last_write_checksum: sha1:351b050b646c9e2dbffaf27633cbd38b30047169 @@ -15254,10 +16042,18 @@ trackedFiles: id: 3ced31e3804e last_write_checksum: sha1:f139bef84fb09ba815b0529517988ff109c13cba pristine_git_object: 8abf4d7aa09edae2e53f7fac0b90d701e9889f98 + src/openrouter/operations/listaccountpolicies.py: + id: 43e7588167c6 + last_write_checksum: sha1:b45f72d17215528a2ae562e37ca99826ecea706b + pristine_git_object: 1d150e3dc9f807f31e1e25def377b7d71d2ff675 src/openrouter/operations/listbatches.py: id: 9ad1345dc956 last_write_checksum: sha1:b7017793a979647ef2ec7fee333e34063664c9eb pristine_git_object: 1dfdcafa35e010924f76a24ed007796e8ad40254 + src/openrouter/operations/listbudgetpolicies.py: + id: a41bedda97cb + last_write_checksum: sha1:18f31f3a12507dd0ceb0b952893e6a2e8e27ca32 + pristine_git_object: cb0680de640f772e1beceb23f5c024d0f0cca82b src/openrouter/operations/listbyokkeys.py: id: b6dd42b3e05f last_write_checksum: sha1:a92b0a231dfc90d6a20198819bb6af38e06dd03c @@ -15330,6 +16126,10 @@ trackedFiles: id: a993b5549126 last_write_checksum: sha1:5a6e2469b141dcee32fd54d75b8fdd726c14d8c5 pristine_git_object: 4ccc06b53c5f45c9fa99dc29623e5b442ed39462 + src/openrouter/operations/listmodelavailabilitypolicies.py: + id: 895490cb05ed + last_write_checksum: sha1:9bded515bbb800ba8cfd073cf20ca2559ee21be0 + pristine_git_object: dac3be4a1284c9a05758f958807e3ad14f0510c7 src/openrouter/operations/listmodelscount.py: id: d588d81b71c2 last_write_checksum: sha1:9428a1ab510072878e6bf57ab249e14978608b85 @@ -15338,6 +16138,10 @@ trackedFiles: id: 16eb5946cf60 last_write_checksum: sha1:eec8c0a76f1fe80183b15617d25580d1547aad2b pristine_git_object: c5b9f8c2f29e740fef85a4e2f2a427d94c6f04bb + src/openrouter/operations/listmoderationpolicies.py: + id: a091a9ee01d0 + last_write_checksum: sha1:e8300ea6f46fb792410d8ba4e1fd0a9200129e1a + pristine_git_object: d5419d4b5228b9027c15b3e2962297bcd8bd5cf5 src/openrouter/operations/listoauthjwks.py: id: 329ac9d6fa76 last_write_checksum: sha1:8d6b08b6637a0ff49f88313a9f1bed03349655f1 @@ -15430,6 +16234,14 @@ trackedFiles: id: a1f4458f5e75 last_write_checksum: sha1:634750972ca2bf7d76b1530f19f0d5401a44c3d8 pristine_git_object: 878e3ec2224f81c003c35efa326d2ba53ee595c0 + src/openrouter/operations/updateaccountpolicy.py: + id: 2aab59e5ab54 + last_write_checksum: sha1:2b934cdd23b36bfa6de846f32986b8d94659496c + pristine_git_object: 6a2bf49a11a2ea7fcf27d3e2524d81f084853e0d + src/openrouter/operations/updatebudgetpolicy.py: + id: e5773b34e0e2 + last_write_checksum: sha1:768a4c730c01f9ef47ee73e92e9e7703dbbf11f4 + pristine_git_object: bc949624f474bfa47b4ba8ef68113cbe2e2d7b50 src/openrouter/operations/updatebyokkey.py: id: 486f4ea60120 last_write_checksum: sha1:a170382e38c66128bddbe8ea18c034d1350910da @@ -15446,6 +16258,14 @@ trackedFiles: id: 56fb213253a8 last_write_checksum: sha1:8a49a1d8fecd7314d177d488ecec30214f4e918b pristine_git_object: e9ed9da08d2a39aa0f9dc295fdd4e006e8dd49f5 + src/openrouter/operations/updatemodelavailabilitypolicy.py: + id: d1b2f4316f03 + last_write_checksum: sha1:c778c8d1210644d625357a6782307d772fcbaa46 + pristine_git_object: 12688403a053b67b02a50dcfa6a3f8f3d821bdd6 + src/openrouter/operations/updatemoderationpolicy.py: + id: a708dc5c10c4 + last_write_checksum: sha1:c1e0533a1b1f8313a5203248a71ae8c69f8d91e5 + pristine_git_object: 043d2ced3ee9276e448d7d5b666b890c938b114c src/openrouter/operations/updateobservabilitydestination.py: id: 18e06708d1b4 last_write_checksum: sha1:d490e19e8698ed5193df9d06673f975cb3a1410f @@ -15520,8 +16340,8 @@ trackedFiles: pristine_git_object: 6bc5fe5e691f5136f59e018dac5998ac36700e10 src/openrouter/sdk.py: id: ee9846c4c9c5 - last_write_checksum: sha1:26c43da1bad4b17e698e25ac6c1edeb141130ab5 - pristine_git_object: 5be8b45edc146fa397b064b08c7ca26e6774d758 + last_write_checksum: sha1:e2ac234f50cf2fa57417f0be1c9222dc8cfcf947 + pristine_git_object: a015bc43a8823e977e7c5f6bdcd46c7cbe2725b8 src/openrouter/sdkconfiguration.py: id: 55773bb98d7c last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001 @@ -20207,5 +21027,494 @@ examples: application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listAccountPolicies: + speakeasy-default-list-account-policies: + responses: + "200": + application/json: {"data": [], "total_count": 1} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createAccountPolicy: + speakeasy-default-create-account-policy: + requestBody: + application/json: {"config": {"include_byok_in_budgets": false, "limit_usd": 200, "reset_interval": "monthly"}, "name": "Engineering monthly budget", "policy_type": "budget"} + responses: + "201": + application/json: {"data": {"config": {}, "created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "is_default": true, "is_synced": false, "is_workspace_default_synced": false, "name": "Engineering monthly budget", "opted_out_workspace_ids": ["0df9e665-d932-5740-b2c7-b52af166bc11"], "policy_type": "moderation", "updated_at": "1735618738537", "workspace_count": 199228, "workspace_ids": ["0df9e665-d932-5740-b2c7-b52af166bc11"]}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteAccountPolicy: + speakeasy-default-delete-account-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + responses: + "200": + application/json: {"data": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + updateAccountPolicy: + speakeasy-default-update-account-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + requestBody: + application/json: {"config": {"include_byok_in_budgets": false, "limit_usd": 200, "reset_interval": "monthly"}, "name": "Engineering monthly budget", "policy_type": "budget"} + responses: + "200": + application/json: {"data": {"config": {}, "created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "is_default": false, "is_synced": true, "is_workspace_default_synced": false, "name": "Engineering monthly budget", "opted_out_workspace_ids": ["0df9e665-d932-5740-b2c7-b52af166bc11"], "policy_type": "budget", "updated_at": null, "workspace_count": 60587, "workspace_ids": ["0df9e665-d932-5740-b2c7-b52af166bc11"]}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getApiKeyPolicyAssignment: + speakeasy-default-get-api-key-policy-assignment: + parameters: + path: + hash: "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + policy_type: "budget" + responses: + "200": + application/json: {"data": {"opted_out": false, "policy_ids": [], "workspace_default_policy_ids": ["2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90"]}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + changeApiKeyPolicyAssignment: + speakeasy-default-change-api-key-policy-assignment: + parameters: + path: + hash: "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93" + requestBody: + application/json: {"assigned": true, "expected_assignment": {"opted_out": false, "policy_ids": [], "workspace_default_policy_ids": ["2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90"]}, "policy_id": "550e8400-e29b-41d4-a716-446655440000", "policy_type": "budget", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "200": + application/json: {"data": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getMemberPolicyAssignment: + speakeasy-default-get-member-policy-assignment: + parameters: + path: + member_id: "user_2abcDEFghiJKLmnoPQRstu" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + policy_type: "budget" + responses: + "200": + application/json: {"data": {"opted_out": false, "policy_ids": [], "workspace_default_policy_ids": ["2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90"]}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + changeMemberPolicyAssignment: + speakeasy-default-change-member-policy-assignment: + parameters: + path: + member_id: "user_2abcDEFghiJKLmnoPQRstu" + requestBody: + application/json: {"assigned": true, "expected_assignment": {"opted_out": false, "policy_ids": [], "workspace_default_policy_ids": ["2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90"]}, "policy_id": "550e8400-e29b-41d4-a716-446655440000", "policy_type": "budget", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "200": + application/json: {"data": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listBudgetPolicies: + speakeasy-default-list-budget-policies: + parameters: + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": [{"api_key_count": 960905, "config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "member_count": 899638, "name": "Engineering monthly budget", "policy_type": "budget", "updated_at": null}], "total_count": 1} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createBudgetPolicy: + speakeasy-default-create-budget-policy: + requestBody: + application/json: {"config": {"include_byok_in_budgets": false, "limit_usd": 200, "reset_interval": "monthly"}, "name": "Engineering monthly budget", "policy_type": "budget", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "201": + application/json: {"data": {"config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Engineering monthly budget", "policy_type": "budget"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteBudgetPolicy: + speakeasy-default-delete-budget-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getBudgetPolicy: + speakeasy-default-get-budget-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": {"api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "member_ids": ["user_2abcDEFghiJKLmnoPQRstu"], "name": "Engineering monthly budget", "opted_out_api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "overridden_api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "policy_type": "budget", "reference": null, "updated_at": "1735672866117"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + updateBudgetPolicy: + speakeasy-default-update-budget-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + requestBody: + application/json: {"config": {"include_byok_in_budgets": false, "limit_usd": 200, "reset_interval": "monthly"}, "name": "Engineering monthly budget", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "200": + application/json: {"data": {"config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Engineering monthly budget", "policy_type": "budget"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listModelAvailabilityPolicies: + speakeasy-default-list-model-availability-policies: + parameters: + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": [], "total_count": 1} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createModelAvailabilityPolicy: + speakeasy-default-create-model-availability-policy: + requestBody: + application/json: {"config": {}, "name": "Engineering monthly budget", "policy_type": "model_availability", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "201": + application/json: {"data": {"config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Engineering monthly budget", "policy_type": "model_availability"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteModelAvailabilityPolicy: + speakeasy-default-delete-model-availability-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getModelAvailabilityPolicy: + speakeasy-default-get-model-availability-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": {"api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "member_ids": ["user_2abcDEFghiJKLmnoPQRstu"], "name": "Engineering monthly budget", "opted_out_api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "overridden_api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "policy_type": "model_availability", "reference": null, "updated_at": "1735624389333"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + updateModelAvailabilityPolicy: + speakeasy-default-update-model-availability-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + requestBody: + application/json: {"config": {}, "name": "Engineering monthly budget", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "200": + application/json: {"data": {"config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Engineering monthly budget", "policy_type": "model_availability"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listModerationPolicies: + speakeasy-default-list-moderation-policies: + parameters: + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": [{"api_key_count": 462350, "config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "member_count": 804269, "name": "Engineering monthly budget", "policy_type": "moderation", "updated_at": "1735656084969"}], "total_count": 1} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createModerationPolicy: + speakeasy-default-create-moderation-policy: + requestBody: + application/json: {"config": {}, "name": "Engineering monthly budget", "policy_type": "moderation", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "201": + application/json: {"data": {"config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Engineering monthly budget", "policy_type": "moderation"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteModerationPolicy: + speakeasy-default-delete-moderation-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getModerationPolicy: + speakeasy-default-get-moderation-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + query: + workspace_id: "0df9e665-d932-5740-b2c7-b52af166bc11" + responses: + "200": + application/json: {"data": {"api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "member_ids": ["user_2abcDEFghiJKLmnoPQRstu"], "name": "Engineering monthly budget", "opted_out_api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "overridden_api_key_hashes": ["c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"], "policy_type": "moderation", "reference": null, "updated_at": "1735631392724"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + updateModerationPolicy: + speakeasy-default-update-moderation-policy: + parameters: + path: + id: "550e8400-e29b-41d4-a716-446655440000" + requestBody: + application/json: {"config": {}, "name": "Engineering monthly budget", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"} + responses: + "200": + application/json: {"data": {"config": {}, "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Engineering monthly budget", "policy_type": "moderation"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.reasoning.max_tokens` **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.guardrail_policies.list_account_policies()`: **Added** + * `open_router.guardrail_policies.create_account_policy()`: **Added** + * `open_router.guardrail_policies.delete_account_policy()`: **Added** + * `open_router.guardrail_policies.update_account_policy()`: **Added** + * `open_router.guardrail_policies.get_api_key_policy_assignment()`: **Added** + * `open_router.guardrail_policies.change_api_key_policy_assignment()`: **Added** + * `open_router.guardrail_policies.get_member_policy_assignment()`: **Added** + * `open_router.guardrail_policies.change_member_policy_assignment()`: **Added** + * `open_router.guardrail_policies.list_budget_policies()`: **Added** + * `open_router.guardrail_policies.create_budget_policy()`: **Added** + * `open_router.guardrail_policies.delete_budget_policy()`: **Added** + * `open_router.guardrail_policies.get_budget_policy()`: **Added** + * `open_router.guardrail_policies.update_budget_policy()`: **Added** + * `open_router.guardrail_policies.list_model_availability_policies()`: **Added** + * `open_router.guardrail_policies.create_model_availability_policy()`: **Added** + * `open_router.guardrail_policies.delete_model_availability_policy()`: **Added** + * `open_router.guardrail_policies.get_model_availability_policy()`: **Added** + * `open_router.guardrail_policies.update_model_availability_policy()`: **Added** + * `open_router.guardrail_policies.list_moderation_policies()`: **Added** + * `open_router.guardrail_policies.create_moderation_policy()`: **Added** + * `open_router.guardrail_policies.delete_moderation_policy()`: **Added** + * `open_router.guardrail_policies.get_moderation_policy()`: **Added** + * `open_router.guardrail_policies.update_moderation_policy()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 1b71fa6c3..6b3bf8b49 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.132 + version: 1.3.133 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 7f183d9bf..46f6dab7f 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -56,6 +56,35 @@ components: - 'coding_index' - 'agentic_index' type: 'object' + AccountGuardrailPolicy: + discriminator: + mapping: + budget: '#/components/schemas/BudgetAccountGuardrailPolicy' + model_availability: '#/components/schemas/ModelAvailabilityAccountGuardrailPolicy' + moderation: '#/components/schemas/ModerationAccountGuardrailPolicy' + propertyName: 'policy_type' + oneOf: + - $ref: '#/components/schemas/BudgetAccountGuardrailPolicy' + - $ref: '#/components/schemas/ModerationAccountGuardrailPolicy' + - $ref: '#/components/schemas/ModelAvailabilityAccountGuardrailPolicy' + AccountGuardrailPolicyRequest: + discriminator: + mapping: + budget: '#/components/schemas/BudgetAccountGuardrailPolicyRequest' + model_availability: '#/components/schemas/ModelAvailabilityAccountGuardrailPolicyRequest' + moderation: '#/components/schemas/ModerationAccountGuardrailPolicyRequest' + propertyName: 'policy_type' + oneOf: + - $ref: '#/components/schemas/BudgetAccountGuardrailPolicyRequest' + - $ref: '#/components/schemas/ModerationAccountGuardrailPolicyRequest' + - $ref: '#/components/schemas/ModelAvailabilityAccountGuardrailPolicyRequest' + AccountGuardrailPolicyResponse: + properties: + data: + $ref: '#/components/schemas/AccountGuardrailPolicy' + required: + - 'data' + type: 'object' ActivityItem: example: byok_usage_inference: 0.012 @@ -6722,6 +6751,345 @@ components: required: - 'type' type: 'object' + BudgetAccountGuardrailPolicy: + properties: + config: + $ref: '#/components/schemas/GuardrailBudgetPolicyConfig' + created_at: + example: '2025-08-24T10:30:00Z' + type: 'string' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_default: + type: 'boolean' + is_synced: + description: 'Kept in sync with a v1 guardrail; saving changes creates an account copy' + type: 'boolean' + is_workspace_default_synced: + description: 'Synced from a v1 workspace default guardrail' + type: 'boolean' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + policy_type: + enum: + - 'budget' + type: 'string' + updated_at: + type: + - 'string' + - 'null' + workspace_count: + minimum: 0 + type: 'integer' + workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'created_at' + - 'updated_at' + - 'is_default' + - 'workspace_count' + - 'workspace_ids' + - 'opted_out_workspace_ids' + - 'is_synced' + - 'is_workspace_default_synced' + type: 'object' + BudgetAccountGuardrailPolicyRequest: + example: + config: + include_byok_in_budgets: false + limit_usd: 200 + reset_interval: 'monthly' + name: 'Engineering monthly budget' + policy_type: 'budget' + workspace_ids: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + properties: + config: + $ref: '#/components/schemas/GuardrailBudgetPolicyAuthoringConfig' + floor_reassignment: + description: 'Move workspaces off this policy onto another workspace-wide policy in the same write' + properties: + policy_id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + minItems: 1 + type: 'array' + required: + - 'policy_id' + - 'workspace_ids' + type: 'object' + is_default: + description: 'Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.' + type: 'boolean' + keep_previous_default_workspaces: + description: 'Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.' + type: 'boolean' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_workspace_ids: + description: 'Workspaces left out of a default policy' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + policy_type: + enum: + - 'budget' + type: 'string' + released_floor_workspace_ids: + description: 'Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + workspace_ids: + description: 'Workspaces the policy covers when it is not the default' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + required: + - 'name' + - 'policy_type' + - 'config' + type: 'object' + BudgetGuardrailPolicy: + properties: + config: + $ref: '#/components/schemas/GuardrailBudgetPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + policy_type: + enum: + - 'budget' + type: 'string' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + type: 'object' + BudgetGuardrailPolicyDetail: + properties: + api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailBudgetPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_workspace_default: + type: 'boolean' + member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + overridden_api_key_hashes: + description: 'API keys that have a different policy of this type assigned directly' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + overridden_member_ids: + description: 'Members that have a different policy of this type assigned directly' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + policy_type: + enum: + - 'budget' + type: 'string' + reference: + default: null + description: '`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`' + enum: + - 'legacy_mapping' + - 'account_default' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + replaces_legacy_default: + description: 'Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted' + type: 'boolean' + updated_at: + type: + - 'string' + - 'null' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'updated_at' + - 'member_ids' + - 'api_key_hashes' + - 'opted_out_api_key_hashes' + - 'overridden_api_key_hashes' + type: 'object' + BudgetGuardrailPolicyDetailResponse: + properties: + data: + $ref: '#/components/schemas/BudgetGuardrailPolicyDetail' + required: + - 'data' + type: 'object' + BudgetGuardrailPolicyResponse: + properties: + data: + $ref: '#/components/schemas/BudgetGuardrailPolicy' + required: + - 'data' + type: 'object' + BudgetGuardrailPolicySummary: + properties: + api_key_count: + minimum: 0 + type: 'integer' + config: + $ref: '#/components/schemas/GuardrailBudgetPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_legacy_mapped: + description: 'Whether the policy is kept in sync with a v1 guardrail' + type: 'boolean' + is_workspace_default: + type: 'boolean' + legacy_guardrail_ids: + description: 'IDs of the v1 guardrails this policy was migrated from' + items: + type: 'string' + type: 'array' + member_count: + minimum: 0 + type: 'integer' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + policy_type: + enum: + - 'budget' + type: 'string' + replaced_legacy_guardrail_ids: + description: 'IDs of the v1 guardrails this policy replaced' + items: + type: 'string' + type: 'array' + updated_at: + type: + - 'string' + - 'null' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'updated_at' + - 'member_count' + - 'api_key_count' + type: 'object' BulkAddWorkspaceMembersRequest: example: user_ids: @@ -7193,6 +7561,52 @@ components: - $ref: '#/components/schemas/EnumCapability' - $ref: '#/components/schemas/RangeCapability' - $ref: '#/components/schemas/BooleanCapability' + ChangeGuardrailPolicyAssignmentRequest: + properties: + assigned: + description: '`true` assigns the policy to the subject, `false` removes it' + example: true + type: 'boolean' + expected_assignment: + allOf: + - $ref: '#/components/schemas/GuardrailPolicyAssignmentState' + - description: 'The assignment state last read for the subject. The request fails with 409 if it changed since.' + policy_id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + policy_type: + description: 'Policy type the assignment is read or changed for' + enum: + - 'budget' + - 'model_availability' + - 'moderation' + - 'rate_limit' + example: 'budget' + type: 'string' + x-speakeasy-unknown-values: allow + workspace_id: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + required: + - 'workspace_id' + - 'policy_type' + - 'policy_id' + - 'assigned' + - 'expected_assignment' + type: 'object' + ChangeGuardrailPolicyAssignmentResponse: + properties: + data: + description: 'Whether the assignment changed' + example: true + type: 'boolean' + required: + - 'data' + type: 'object' ChatAssistantImages: description: 'Generated images from image generation models' example: @@ -9906,6 +10320,70 @@ components: type: - 'object' - 'null' + CreateBudgetGuardrailPolicyRequest: + properties: + api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailBudgetPolicyAuthoringConfig' + is_workspace_default: + description: 'Make this the workspace default for its policy type. Defaults to `false`.' + type: 'boolean' + member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API keys that should not inherit the policy when it is the workspace default' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Members that should not inherit the policy when it is the workspace default' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + policy_type: + enum: + - 'budget' + type: 'string' + workspace_id: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + required: + - 'name' + - 'policy_type' + - 'config' + - 'workspace_id' + type: 'object' CreateBYOKKeyRequest: example: key: 'sk-proj-abc123...' @@ -10326,6 +10804,134 @@ components: required: - 'data' type: 'object' + CreateModelAvailabilityGuardrailPolicyRequest: + properties: + api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailModelAvailabilityPolicyAuthoringConfig' + is_workspace_default: + description: 'Make this the workspace default for its policy type. Defaults to `false`.' + type: 'boolean' + member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API keys that should not inherit the policy when it is the workspace default' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Members that should not inherit the policy when it is the workspace default' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + policy_type: + enum: + - 'model_availability' + type: 'string' + workspace_id: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + required: + - 'name' + - 'policy_type' + - 'config' + - 'workspace_id' + type: 'object' + CreateModerationGuardrailPolicyRequest: + properties: + api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailModerationPolicyConfig' + is_workspace_default: + description: 'Make this the workspace default for its policy type. Defaults to `false`.' + type: 'boolean' + member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API keys that should not inherit the policy when it is the workspace default' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Members that should not inherit the policy when it is the workspace default' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + policy_type: + enum: + - 'moderation' + type: 'string' + workspace_id: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + required: + - 'name' + - 'policy_type' + - 'config' + - 'workspace_id' + type: 'object' CreateObservabilityDestinationRequest: example: config: @@ -11636,6 +12242,15 @@ components: required: - 'deleted' type: 'object' + DeleteGuardrailPolicyResponse: + properties: + data: + description: 'Whether the policy was deleted' + example: true + type: 'boolean' + required: + - 'data' + type: 'object' DeleteGuardrailResponse: example: deleted: true @@ -15186,6 +15801,56 @@ components: - 'created_at' - 'workspace_id' type: 'object' + GuardrailBudgetPolicyAuthoringConfig: + additionalProperties: false + example: + include_byok_in_budgets: false + limit_usd: 200 + reset_interval: 'monthly' + properties: + include_byok_in_budgets: + type: 'boolean' + limit_usd: + exclusiveMinimum: 0 + minimum: 0 + type: + - 'number' + - 'null' + reset_interval: + enum: + - 'daily' + - 'weekly' + - 'monthly' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + required: + - 'limit_usd' + - 'reset_interval' + - 'include_byok_in_budgets' + type: 'object' + GuardrailBudgetPolicyConfig: + example: + include_byok_in_budgets: false + limit_usd: 200 + reset_interval: 'monthly' + properties: + include_byok_in_budgets: + description: 'Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail''s limit_usd, in addition to OpenRouter credit spend. Defaults to false.' + example: false + type: 'boolean' + limit_usd: + description: 'Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400.' + example: 50 + format: 'double' + type: + - 'number' + - 'null' + reset_interval: + $ref: '#/components/schemas/GuardrailInterval' + type: 'object' GuardrailDataRegion: description: 'An OpenRouter data region: `global` (https://openrouter.ai), `europe` (https://eu.openrouter.ai), or `us` (https://us.openrouter.ai)' enum: @@ -15207,6 +15872,443 @@ components: - 'string' - 'null' x-speakeasy-unknown-values: allow + GuardrailModelAvailabilityPolicyAuthoringConfig: + additionalProperties: false + example: + allowed_models: + - 'openai/gpt-4o' + - 'anthropic/claude-sonnet-4' + allowed_providers: + - 'openai' + - 'anthropic' + enforce_zdr_anthropic: true + enforce_zdr_openai: true + properties: + allow_safety_retention_google: + type: + - 'boolean' + - 'null' + allow_safety_retention_other: + type: + - 'boolean' + - 'null' + allowed_data_regions: + items: + type: 'string' + minItems: 1 + type: + - 'array' + - 'null' + allowed_models: + items: + type: 'string' + type: + - 'array' + - 'null' + allowed_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + enable_free_model_publication: + type: + - 'boolean' + - 'null' + enable_free_model_training: + type: + - 'boolean' + - 'null' + enable_paid_model_training: + type: + - 'boolean' + - 'null' + enforce_first_party_harness_models: + type: + - 'boolean' + - 'null' + enforce_zdr: + type: + - 'boolean' + - 'null' + enforce_zdr_anthropic: + type: + - 'boolean' + - 'null' + enforce_zdr_google: + type: + - 'boolean' + - 'null' + enforce_zdr_openai: + type: + - 'boolean' + - 'null' + enforce_zdr_other: + type: + - 'boolean' + - 'null' + enforce_zdr_xai: + type: + - 'boolean' + - 'null' + ignored_models: + items: + type: 'string' + type: + - 'array' + - 'null' + ignored_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + platform_banned_authors: + items: + type: 'string' + type: + - 'array' + - 'null' + platform_banned_models: + items: + type: 'string' + type: + - 'array' + - 'null' + platform_banned_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + require_eu_data_region: + type: + - 'boolean' + - 'null' + type: 'object' + GuardrailModelAvailabilityPolicyConfig: + additionalProperties: false + example: + allowed_models: + - 'openai/gpt-4o' + - 'anthropic/claude-sonnet-4' + allowed_providers: + - 'openai' + - 'anthropic' + enforce_zdr_anthropic: true + enforce_zdr_openai: true + properties: + allow_safety_retention_google: + type: + - 'boolean' + - 'null' + allow_safety_retention_other: + type: + - 'boolean' + - 'null' + allowed_data_regions: + items: + type: 'string' + type: + - 'array' + - 'null' + allowed_models: + items: + type: 'string' + type: + - 'array' + - 'null' + allowed_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + enable_free_model_publication: + type: + - 'boolean' + - 'null' + enable_free_model_training: + type: + - 'boolean' + - 'null' + enable_paid_model_training: + type: + - 'boolean' + - 'null' + enforce_first_party_harness_models: + type: + - 'boolean' + - 'null' + enforce_zdr: + type: + - 'boolean' + - 'null' + enforce_zdr_anthropic: + type: + - 'boolean' + - 'null' + enforce_zdr_google: + type: + - 'boolean' + - 'null' + enforce_zdr_openai: + type: + - 'boolean' + - 'null' + enforce_zdr_other: + type: + - 'boolean' + - 'null' + enforce_zdr_xai: + type: + - 'boolean' + - 'null' + ignored_models: + items: + type: 'string' + type: + - 'array' + - 'null' + ignored_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + platform_banned_authors: + items: + type: 'string' + type: + - 'array' + - 'null' + platform_banned_models: + items: + type: 'string' + type: + - 'array' + - 'null' + platform_banned_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + require_eu_data_region: + type: + - 'boolean' + - 'null' + type: 'object' + GuardrailModerationPolicyConfig: + additionalProperties: false + example: + content_filter_builtins: + - action: 'block' + slug: 'secrets' + properties: + armor: + additionalProperties: false + properties: + classifier_context: + $ref: '#/components/schemas/ArmorContext' + mode: + description: '`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.' + enum: + - 'enforce' + - 'audit' + type: 'string' + x-speakeasy-unknown-values: allow + on_error: + description: 'When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.' + enum: + - 'log' + - 'block' + type: 'string' + x-speakeasy-unknown-values: allow + use_cc_style_default_rules: + description: 'Prepend Claude Code''s built-in auto-mode rule set (1 hard-deny, 72 soft-deny, 17 allow, 21 environment slots) ahead of every configured rule. Defaults to true on the Anthropic Messages API and false elsewhere.' + type: 'boolean' + type: + - 'object' + - 'null' + broadcast_model_armor_flagged_requests: + type: + - 'boolean' + - 'null' + content_filter_blocks_requests: + type: 'boolean' + content_filter_builtins: + items: + additionalProperties: false + properties: + action: + enum: + - 'redact' + - 'block' + - 'flag' + type: 'string' + x-speakeasy-unknown-values: allow + label: + maxLength: 100 + type: 'string' + scan_scope: + enum: + - 'user_only' + - 'all_messages' + type: 'string' + x-speakeasy-unknown-values: allow + slug: + enum: + - 'email' + - 'phone' + - 'ssn' + - 'credit-card' + - 'ip-address' + - 'secrets' + - 'person-name' + - 'address' + - 'regex-prompt-injection' + type: 'string' + x-speakeasy-unknown-values: allow + required: + - 'slug' + - 'action' + type: 'object' + type: + - 'array' + - 'null' + content_filter_patterns: + items: + type: 'string' + type: + - 'array' + - 'null' + content_filters: + items: + additionalProperties: false + properties: + action: + enum: + - 'redact' + - 'block' + - 'flag' + type: 'string' + x-speakeasy-unknown-values: allow + label: + maxLength: 100 + type: + - 'string' + - 'null' + pattern: + maxLength: 100000 + minLength: 1 + type: 'string' + required: + - 'pattern' + - 'action' + type: 'object' + type: + - 'array' + - 'null' + enable_model_armor_injection_protection: + type: + - 'boolean' + - 'null' + lakera_injection_protection_mode: + enum: + - 'block' + - 'flag' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + model_armor_injection_confidence_level: + enum: + - 'low' + - 'medium' + - 'high' + type: 'string' + x-speakeasy-unknown-values: allow + model_armor_injection_protection_mode: + enum: + - 'block' + - 'flag' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + pii_filters: + items: + additionalProperties: false + properties: + action: + enum: + - 'redact' + - 'block' + - 'flag' + type: 'string' + x-speakeasy-unknown-values: allow + entity_type: + type: 'string' + score_threshold: + maximum: 1 + minimum: 0 + type: 'number' + required: + - 'entity_type' + - 'action' + type: 'object' + type: + - 'array' + - 'null' + platform_image_moderated_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + platform_moderated_providers: + items: + type: 'string' + type: + - 'array' + - 'null' + type: 'object' + GuardrailPolicyAssignmentResponse: + properties: + data: + $ref: '#/components/schemas/GuardrailPolicyAssignmentState' + required: + - 'data' + type: 'object' + GuardrailPolicyAssignmentState: + properties: + opted_out: + description: 'Whether the subject is opted out of the workspace default' + example: false + type: 'boolean' + policy_ids: + description: 'Policies of this type assigned directly to the subject' + example: [] + items: + format: 'uuid' + type: 'string' + type: 'array' + workspace_default_policy_ids: + description: 'Workspace default policies of this type the subject inherits' + example: + - '2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90' + items: + format: 'uuid' + type: 'string' + type: 'array' + required: + - 'policy_ids' + - 'workspace_default_policy_ids' + - 'opted_out' + type: 'object' ImageConfig: additionalProperties: anyOf: @@ -16938,6 +18040,36 @@ components: required: - 'type' type: 'object' + ListAccountGuardrailPoliciesResponse: + properties: + data: + items: + $ref: '#/components/schemas/AccountGuardrailPolicy' + type: 'array' + total_count: + description: 'Total number of policies' + example: 1 + minimum: 0 + type: 'integer' + required: + - 'data' + - 'total_count' + type: 'object' + ListBudgetGuardrailPoliciesResponse: + properties: + data: + items: + $ref: '#/components/schemas/BudgetGuardrailPolicySummary' + type: 'array' + total_count: + description: 'Total number of policies' + example: 1 + minimum: 0 + type: 'integer' + required: + - 'data' + - 'total_count' + type: 'object' ListBYOKKeysResponse: example: data: @@ -17204,6 +18336,36 @@ components: - 'data' - 'total_count' type: 'object' + ListModelAvailabilityGuardrailPoliciesResponse: + properties: + data: + items: + $ref: '#/components/schemas/ModelAvailabilityGuardrailPolicySummary' + type: 'array' + total_count: + description: 'Total number of policies' + example: 1 + minimum: 0 + type: 'integer' + required: + - 'data' + - 'total_count' + type: 'object' + ListModerationGuardrailPoliciesResponse: + properties: + data: + items: + $ref: '#/components/schemas/ModerationGuardrailPolicySummary' + type: 'array' + total_count: + description: 'Total number of policies' + example: 1 + minimum: 0 + type: 'integer' + required: + - 'data' + - 'total_count' + type: 'object' ListObservabilityDestinationsResponse: example: data: @@ -20171,6 +21333,350 @@ components: - 'input_modalities' - 'output_modalities' type: 'object' + ModelAvailabilityAccountGuardrailPolicy: + properties: + config: + $ref: '#/components/schemas/GuardrailModelAvailabilityPolicyConfig' + created_at: + example: '2025-08-24T10:30:00Z' + type: 'string' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_default: + type: 'boolean' + is_synced: + description: 'Kept in sync with a v1 guardrail; saving changes creates an account copy' + type: 'boolean' + is_workspace_default_synced: + description: 'Synced from a v1 workspace default guardrail' + type: 'boolean' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + policy_type: + enum: + - 'model_availability' + type: 'string' + updated_at: + type: + - 'string' + - 'null' + workspace_count: + minimum: 0 + type: 'integer' + workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'created_at' + - 'updated_at' + - 'is_default' + - 'workspace_count' + - 'workspace_ids' + - 'opted_out_workspace_ids' + - 'is_synced' + - 'is_workspace_default_synced' + type: 'object' + ModelAvailabilityAccountGuardrailPolicyRequest: + example: + config: + allowed_models: + - 'openai/gpt-4o' + - 'anthropic/claude-sonnet-4' + allowed_providers: + - 'openai' + - 'anthropic' + enforce_zdr_anthropic: true + enforce_zdr_openai: true + name: 'Approved models' + policy_type: 'model_availability' + workspace_ids: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + properties: + config: + $ref: '#/components/schemas/GuardrailModelAvailabilityPolicyAuthoringConfig' + floor_reassignment: + description: 'Move workspaces off this policy onto another workspace-wide policy in the same write' + properties: + policy_id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + minItems: 1 + type: 'array' + required: + - 'policy_id' + - 'workspace_ids' + type: 'object' + is_default: + description: 'Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.' + type: 'boolean' + keep_previous_default_workspaces: + description: 'Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.' + type: 'boolean' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_workspace_ids: + description: 'Workspaces left out of a default policy' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + policy_type: + enum: + - 'model_availability' + type: 'string' + released_floor_workspace_ids: + description: 'Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + workspace_ids: + description: 'Workspaces the policy covers when it is not the default' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + required: + - 'name' + - 'policy_type' + - 'config' + type: 'object' + ModelAvailabilityGuardrailPolicy: + properties: + config: + $ref: '#/components/schemas/GuardrailModelAvailabilityPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + policy_type: + enum: + - 'model_availability' + type: 'string' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + type: 'object' + ModelAvailabilityGuardrailPolicyDetail: + properties: + api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailModelAvailabilityPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_workspace_default: + type: 'boolean' + member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + overridden_api_key_hashes: + description: 'API keys that have a different policy of this type assigned directly' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + overridden_member_ids: + description: 'Members that have a different policy of this type assigned directly' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + policy_type: + enum: + - 'model_availability' + type: 'string' + reference: + default: null + description: '`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`' + enum: + - 'legacy_mapping' + - 'account_default' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + replaces_legacy_default: + description: 'Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted' + type: 'boolean' + updated_at: + type: + - 'string' + - 'null' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'updated_at' + - 'member_ids' + - 'api_key_hashes' + - 'opted_out_api_key_hashes' + - 'overridden_api_key_hashes' + type: 'object' + ModelAvailabilityGuardrailPolicyDetailResponse: + properties: + data: + $ref: '#/components/schemas/ModelAvailabilityGuardrailPolicyDetail' + required: + - 'data' + type: 'object' + ModelAvailabilityGuardrailPolicyResponse: + properties: + data: + $ref: '#/components/schemas/ModelAvailabilityGuardrailPolicy' + required: + - 'data' + type: 'object' + ModelAvailabilityGuardrailPolicySummary: + properties: + api_key_count: + minimum: 0 + type: 'integer' + config: + $ref: '#/components/schemas/GuardrailModelAvailabilityPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_legacy_mapped: + description: 'Whether the policy is kept in sync with a v1 guardrail' + type: 'boolean' + is_workspace_default: + type: 'boolean' + legacy_guardrail_ids: + description: 'IDs of the v1 guardrails this policy was migrated from' + items: + type: 'string' + type: 'array' + member_count: + minimum: 0 + type: 'integer' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + policy_type: + enum: + - 'model_availability' + type: 'string' + replaced_legacy_guardrail_ids: + description: 'IDs of the v1 guardrails this policy replaced' + items: + type: 'string' + type: 'array' + updated_at: + type: + - 'string' + - 'null' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'updated_at' + - 'member_count' + - 'api_key_count' + type: 'object' ModelBenchmarks: description: 'Third-party benchmark rankings for this model. Omitted when no benchmark data is available.' example: @@ -20455,6 +21961,348 @@ components: items: $ref: '#/components/schemas/Model' type: 'array' + ModerationAccountGuardrailPolicy: + properties: + config: + $ref: '#/components/schemas/GuardrailModerationPolicyConfig' + created_at: + example: '2025-08-24T10:30:00Z' + type: 'string' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_default: + type: 'boolean' + is_synced: + description: 'Kept in sync with a v1 guardrail; saving changes creates an account copy' + type: 'boolean' + is_workspace_default_synced: + description: 'Synced from a v1 workspace default guardrail' + type: 'boolean' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + policy_type: + enum: + - 'moderation' + type: 'string' + updated_at: + type: + - 'string' + - 'null' + workspace_count: + minimum: 0 + type: 'integer' + workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'created_at' + - 'updated_at' + - 'is_default' + - 'workspace_count' + - 'workspace_ids' + - 'opted_out_workspace_ids' + - 'is_synced' + - 'is_workspace_default_synced' + type: 'object' + ModerationAccountGuardrailPolicyRequest: + example: + config: + content_filter_builtins: + - action: 'block' + slug: 'secrets' + name: 'Block secrets' + policy_type: 'moderation' + workspace_ids: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + properties: + config: + $ref: '#/components/schemas/GuardrailModerationPolicyConfig' + floor_reassignment: + description: 'Move workspaces off this policy onto another workspace-wide policy in the same write' + properties: + policy_id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + workspace_ids: + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + minItems: 1 + type: 'array' + required: + - 'policy_id' + - 'workspace_ids' + type: 'object' + is_default: + description: 'Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.' + type: 'boolean' + keep_previous_default_workspaces: + description: 'Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.' + type: 'boolean' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_workspace_ids: + description: 'Workspaces left out of a default policy' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + policy_type: + enum: + - 'moderation' + type: 'string' + released_floor_workspace_ids: + description: 'Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + workspace_ids: + description: 'Workspaces the policy covers when it is not the default' + example: + - '0df9e665-d932-5740-b2c7-b52af166bc11' + items: + format: 'uuid' + type: 'string' + type: 'array' + required: + - 'name' + - 'policy_type' + - 'config' + type: 'object' + ModerationGuardrailPolicy: + properties: + config: + $ref: '#/components/schemas/GuardrailModerationPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + policy_type: + enum: + - 'moderation' + type: 'string' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + type: 'object' + ModerationGuardrailPolicyDetail: + properties: + api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailModerationPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_account_policy: + description: 'Whether this is an account-owned policy rather than a workspace policy' + type: 'boolean' + is_workspace_default: + type: 'boolean' + member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + overridden_api_key_hashes: + description: 'API keys that have a different policy of this type assigned directly' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + overridden_member_ids: + description: 'Members that have a different policy of this type assigned directly' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + policy_type: + enum: + - 'moderation' + type: 'string' + reference: + default: null + description: '`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`' + enum: + - 'legacy_mapping' + - 'account_default' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + replaces_legacy_default: + description: 'Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted' + type: 'boolean' + updated_at: + type: + - 'string' + - 'null' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'updated_at' + - 'member_ids' + - 'api_key_hashes' + - 'opted_out_api_key_hashes' + - 'overridden_api_key_hashes' + type: 'object' + ModerationGuardrailPolicyDetailResponse: + properties: + data: + $ref: '#/components/schemas/ModerationGuardrailPolicyDetail' + required: + - 'data' + type: 'object' + ModerationGuardrailPolicyResponse: + properties: + data: + $ref: '#/components/schemas/ModerationGuardrailPolicy' + required: + - 'data' + type: 'object' + ModerationGuardrailPolicySummary: + properties: + api_key_count: + minimum: 0 + type: 'integer' + config: + $ref: '#/components/schemas/GuardrailModerationPolicyConfig' + id: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + is_legacy_mapped: + description: 'Whether the policy is kept in sync with a v1 guardrail' + type: 'boolean' + is_workspace_default: + type: 'boolean' + legacy_guardrail_ids: + description: 'IDs of the v1 guardrails this policy was migrated from' + items: + type: 'string' + type: 'array' + member_count: + minimum: 0 + type: 'integer' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + policy_type: + enum: + - 'moderation' + type: 'string' + replaced_legacy_guardrail_ids: + description: 'IDs of the v1 guardrails this policy replaced' + items: + type: 'string' + type: 'array' + updated_at: + type: + - 'string' + - 'null' + required: + - 'id' + - 'name' + - 'policy_type' + - 'config' + - 'updated_at' + - 'member_count' + - 'api_key_count' + type: 'object' ModerationPlugin: example: id: 'moderation' @@ -34341,6 +36189,65 @@ components: - 'code' - 'message' type: 'object' + UpdateBudgetGuardrailPolicyRequest: + properties: + api_key_hashes: + description: 'Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailBudgetPolicyAuthoringConfig' + is_workspace_default: + description: 'Omit to keep the stored default status; `false` unsets the policy as the workspace default.' + type: 'boolean' + member_ids: + description: 'Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + workspace_id: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + required: + - 'name' + - 'config' + - 'workspace_id' + type: 'object' UpdateBYOKKeyRequest: example: disabled: false @@ -34678,6 +36585,124 @@ components: required: - 'data' type: 'object' + UpdateModelAvailabilityGuardrailPolicyRequest: + properties: + api_key_hashes: + description: 'Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailModelAvailabilityPolicyAuthoringConfig' + is_workspace_default: + description: 'Omit to keep the stored default status; `false` unsets the policy as the workspace default.' + type: 'boolean' + member_ids: + description: 'Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + workspace_id: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + required: + - 'name' + - 'config' + - 'workspace_id' + type: 'object' + UpdateModerationGuardrailPolicyRequest: + properties: + api_key_hashes: + description: 'Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + config: + $ref: '#/components/schemas/GuardrailModerationPolicyConfig' + is_workspace_default: + description: 'Omit to keep the stored default status; `false` unsets the policy as the workspace default.' + type: 'boolean' + member_ids: + description: 'Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + name: + description: 'Policy name' + example: 'Engineering monthly budget' + maxLength: 255 + minLength: 1 + type: 'string' + opted_out_api_key_hashes: + description: 'API key hashes' + example: + - 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + opted_out_member_ids: + description: 'Organization member user IDs' + example: + - 'user_2abcDEFghiJKLmnoPQRstu' + items: + maxLength: 255 + minLength: 1 + type: 'string' + type: 'array' + workspace_id: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + required: + - 'name' + - 'config' + - 'workspace_id' + type: 'object' UpdateObservabilityDestinationRequest: example: enabled: false @@ -44941,6 +46966,2133 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/account: + get: + description: 'List the workspace-wide policies that apply across workspaces in the account. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'listAccountPolicies' + parameters: + - description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'offset' + required: false + schema: + description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + example: 0 + minimum: 0 + type: 'integer' + nullable: false + - description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'limit' + required: false + schema: + description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + example: 50 + maximum: 100 + minimum: 1 + type: 'integer' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListAccountGuardrailPoliciesResponse' + description: 'List of workspace-wide policies' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List workspace-wide policies' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'listAccountPolicies' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'offset' + type: 'offset' + - in: 'parameters' + name: 'limit' + type: 'limit' + outputs: + results: '$.data' + type: 'offsetLimit' + post: + description: 'Create a workspace-wide budget, moderation, or model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'createAccountPolicy' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AccountGuardrailPolicyRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/AccountGuardrailPolicyResponse' + description: 'Workspace-wide policy created' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Create a workspace-wide policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'createAccountPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/account/{id}: + delete: + description: 'Delete a workspace-wide policy. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'deleteAccountPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteGuardrailPolicyResponse' + description: 'Workspace-wide policy deleted' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Delete a workspace-wide policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'deleteAccountPolicy' + put: + description: 'Replace a workspace-wide policy and its workspace coverage. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'updateAccountPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AccountGuardrailPolicyRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AccountGuardrailPolicyResponse' + description: 'Workspace-wide policy updated' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Update a workspace-wide policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'updateAccountPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/assignments/api-keys/{hash}: + get: + description: 'Get the policies of one type that apply to an API key in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'getApiKeyPolicyAssignment' + parameters: + - description: 'API key hash' + in: 'path' + name: 'hash' + required: true + schema: + description: 'API key hash' + example: 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + minLength: 1 + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + - description: 'Policy type the assignment is read or changed for' + in: 'query' + name: 'policy_type' + required: true + schema: + description: 'Policy type the assignment is read or changed for' + enum: + - 'budget' + - 'model_availability' + - 'moderation' + - 'rate_limit' + example: 'budget' + type: 'string' + x-speakeasy-unknown-values: allow + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GuardrailPolicyAssignmentResponse' + description: 'Assignment state' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Get an API key policy assignment' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'getApiKeyPolicyAssignment' + put: + description: 'Assign or unassign one policy for an API key. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'changeApiKeyPolicyAssignment' + parameters: + - description: 'API key hash' + in: 'path' + name: 'hash' + required: true + schema: + description: 'API key hash' + example: 'c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93' + minLength: 1 + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeGuardrailPolicyAssignmentRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeGuardrailPolicyAssignmentResponse' + description: 'Assignment changed' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Change an API key policy assignment' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'changeApiKeyPolicyAssignment' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/assignments/members/{member_id}: + get: + description: 'Get the policies of one type that apply to a member in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'getMemberPolicyAssignment' + parameters: + - description: 'Organization member user ID' + in: 'path' + name: 'member_id' + required: true + schema: + description: 'Organization member user ID' + example: 'user_2abcDEFghiJKLmnoPQRstu' + minLength: 1 + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + - description: 'Policy type the assignment is read or changed for' + in: 'query' + name: 'policy_type' + required: true + schema: + description: 'Policy type the assignment is read or changed for' + enum: + - 'budget' + - 'model_availability' + - 'moderation' + - 'rate_limit' + example: 'budget' + type: 'string' + x-speakeasy-unknown-values: allow + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GuardrailPolicyAssignmentResponse' + description: 'Assignment state' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Get a member policy assignment' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'getMemberPolicyAssignment' + put: + description: 'Assign or unassign one policy for a member. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'changeMemberPolicyAssignment' + parameters: + - description: 'Organization member user ID' + in: 'path' + name: 'member_id' + required: true + schema: + description: 'Organization member user ID' + example: 'user_2abcDEFghiJKLmnoPQRstu' + minLength: 1 + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeGuardrailPolicyAssignmentRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeGuardrailPolicyAssignmentResponse' + description: 'Assignment changed' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Change a member policy assignment' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'changeMemberPolicyAssignment' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/budget: + get: + description: 'List the budget policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'listBudgetPolicies' + parameters: + - description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'offset' + required: false + schema: + description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + example: 0 + minimum: 0 + type: 'integer' + nullable: false + - description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'limit' + required: false + schema: + description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + example: 50 + maximum: 100 + minimum: 1 + type: 'integer' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListBudgetGuardrailPoliciesResponse' + description: 'List of budget policies' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List budget policies' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'listBudgetPolicies' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'offset' + type: 'offset' + - in: 'parameters' + name: 'limit' + type: 'limit' + outputs: + results: '$.data' + type: 'offsetLimit' + post: + description: 'Create a budget policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'createBudgetPolicy' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateBudgetGuardrailPolicyRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/BudgetGuardrailPolicyResponse' + description: 'budget policy created' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Create a budget policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'createBudgetPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/budget/{id}: + delete: + description: 'Delete a budget policy. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'deleteBudgetPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteGuardrailPolicyResponse' + description: 'budget policy deleted' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Delete a budget policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'deleteBudgetPolicy' + get: + description: 'Get a budget policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'getBudgetPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BudgetGuardrailPolicyDetailResponse' + description: 'budget policy details' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Get a budget policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'getBudgetPolicy' + put: + description: 'Replace a budget policy''s name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'updateBudgetPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateBudgetGuardrailPolicyRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BudgetGuardrailPolicyResponse' + description: 'budget policy updated' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Update a budget policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'updateBudgetPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/model-availability: + get: + description: 'List the model availability policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'listModelAvailabilityPolicies' + parameters: + - description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'offset' + required: false + schema: + description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + example: 0 + minimum: 0 + type: 'integer' + nullable: false + - description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'limit' + required: false + schema: + description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + example: 50 + maximum: 100 + minimum: 1 + type: 'integer' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListModelAvailabilityGuardrailPoliciesResponse' + description: 'List of model availability policies' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List model availability policies' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'listModelAvailabilityPolicies' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'offset' + type: 'offset' + - in: 'parameters' + name: 'limit' + type: 'limit' + outputs: + results: '$.data' + type: 'offsetLimit' + post: + description: 'Create a model availability policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'createModelAvailabilityPolicy' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateModelAvailabilityGuardrailPolicyRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ModelAvailabilityGuardrailPolicyResponse' + description: 'model availability policy created' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Create a model availability policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'createModelAvailabilityPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/model-availability/{id}: + delete: + description: 'Delete a model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'deleteModelAvailabilityPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteGuardrailPolicyResponse' + description: 'model availability policy deleted' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Delete a model availability policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'deleteModelAvailabilityPolicy' + get: + description: 'Get a model availability policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'getModelAvailabilityPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ModelAvailabilityGuardrailPolicyDetailResponse' + description: 'model availability policy details' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Get a model availability policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'getModelAvailabilityPolicy' + put: + description: 'Replace a model availability policy''s name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'updateModelAvailabilityPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateModelAvailabilityGuardrailPolicyRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ModelAvailabilityGuardrailPolicyResponse' + description: 'model availability policy updated' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Update a model availability policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'updateModelAvailabilityPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/moderation: + get: + description: 'List the moderation policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'listModerationPolicies' + parameters: + - description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'offset' + required: false + schema: + description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + example: 0 + minimum: 0 + type: 'integer' + nullable: false + - description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'limit' + required: false + schema: + description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + example: 50 + maximum: 100 + minimum: 1 + type: 'integer' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListModerationGuardrailPoliciesResponse' + description: 'List of moderation policies' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List moderation policies' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'listModerationPolicies' + x-speakeasy-pagination: + inputs: + - in: 'parameters' + name: 'offset' + type: 'offset' + - in: 'parameters' + name: 'limit' + type: 'limit' + outputs: + results: '$.data' + type: 'offsetLimit' + post: + description: 'Create a moderation policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'createModerationPolicy' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateModerationGuardrailPolicyRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ModerationGuardrailPolicyResponse' + description: 'moderation policy created' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Create a moderation policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'createModerationPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/moderation/{id}: + delete: + description: 'Delete a moderation policy. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'deleteModerationPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteGuardrailPolicyResponse' + description: 'moderation policy deleted' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Delete a moderation policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'deleteModerationPolicy' + get: + description: 'Get a moderation policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'getModerationPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + - description: 'Workspace the policy belongs to' + in: 'query' + name: 'workspace_id' + required: true + schema: + description: 'Workspace the policy belongs to' + example: '0df9e665-d932-5740-b2c7-b52af166bc11' + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ModerationGuardrailPolicyDetailResponse' + description: 'moderation policy details' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Get a moderation policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'getModerationPolicy' + put: + description: 'Replace a moderation policy''s name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'updateModerationPolicy' + parameters: + - description: 'Policy ID' + in: 'path' + name: 'id' + required: true + schema: + description: 'Policy ID' + example: '550e8400-e29b-41d4-a716-446655440000' + format: 'uuid' + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateModerationGuardrailPolicyRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ModerationGuardrailPolicyResponse' + description: 'moderation policy updated' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Update a moderation policy' + tags: + - 'Guardrail Policies' + x-speakeasy-name-override: 'updateModerationPolicy' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /images: post: description: 'Generates an image from a text prompt via the image generation router' @@ -57331,6 +61483,8 @@ tags: name: 'Files' - description: 'Generation history endpoints' name: 'Generations' + - description: 'Guardrail Policies endpoints' + name: 'Guardrail Policies' - description: 'Guardrails endpoints' name: 'Guardrails' - description: 'Images endpoints' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 164f90eae..9fd59f6d5 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:7fa53baff74eba40ecab14053aff50edff9bfeda6cc0c9a253bbf5dacce30f92 - sourceBlobDigest: sha256:25762da0a3ec232b94ad91452bf08c3c87f0fa962252a43cda859120cccaf1ec + sourceRevisionDigest: sha256:32e6f27c711a47de1df4736da8dd46322a23aa3a6ebf4ae72a32365f0eccef54 + sourceBlobDigest: sha256:3f24df2097b4e6ea0a2e78c3a05348003ce35e479fc7fb4f44e477cee935569e tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:7fa53baff74eba40ecab14053aff50edff9bfeda6cc0c9a253bbf5dacce30f92 - sourceBlobDigest: sha256:25762da0a3ec232b94ad91452bf08c3c87f0fa962252a43cda859120cccaf1ec + sourceRevisionDigest: sha256:32e6f27c711a47de1df4736da8dd46322a23aa3a6ebf4ae72a32365f0eccef54 + sourceBlobDigest: sha256:3f24df2097b4e6ea0a2e78c3a05348003ce35e479fc7fb4f44e477cee935569e codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:b78bd40223c09d9bc104a66eb734dd5b5306bbb494ca4b6dff108da6578cf178 + codeSamplesRevisionDigest: sha256:c61748d4ef59c9dba3f8d6cc7cbb16c42f24affbf502f307bed9777c87293eaf workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 323a5bf82..583700b05 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4089,4 +4089,14 @@ Based on: ### Generated - [python v1.3.132] . ### Releases -- [PyPI v1.3.132] https://pypi.org/project/openrouter/1.3.132 - . \ No newline at end of file +- [PyPI v1.3.132] https://pypi.org/project/openrouter/1.3.132 - . + +## 2026-11-06 00:48:35 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.133] . +### Releases +- [PyPI v1.3.133] https://pypi.org/project/openrouter/1.3.133 - . \ No newline at end of file diff --git a/docs/components/accountguardrailpolicy.mdx b/docs/components/accountguardrailpolicy.mdx new file mode 100644 index 000000000..a1372e9c2 --- /dev/null +++ b/docs/components/accountguardrailpolicy.mdx @@ -0,0 +1,24 @@ +--- +title: "AccountGuardrailPolicy" +--- + +## Supported Types + +### `components.BudgetAccountGuardrailPolicy` + +```python +value: components.BudgetAccountGuardrailPolicy = /* values here */ +``` + +### `components.ModelAvailabilityAccountGuardrailPolicy` + +```python +value: components.ModelAvailabilityAccountGuardrailPolicy = /* values here */ +``` + +### `components.ModerationAccountGuardrailPolicy` + +```python +value: components.ModerationAccountGuardrailPolicy = /* values here */ +``` + diff --git a/docs/components/accountguardrailpolicyrequest.mdx b/docs/components/accountguardrailpolicyrequest.mdx new file mode 100644 index 000000000..be3cbc9b7 --- /dev/null +++ b/docs/components/accountguardrailpolicyrequest.mdx @@ -0,0 +1,24 @@ +--- +title: "AccountGuardrailPolicyRequest" +--- + +## Supported Types + +### `components.BudgetAccountGuardrailPolicyRequest` + +```python +value: components.BudgetAccountGuardrailPolicyRequest = /* values here */ +``` + +### `components.ModelAvailabilityAccountGuardrailPolicyRequest` + +```python +value: components.ModelAvailabilityAccountGuardrailPolicyRequest = /* values here */ +``` + +### `components.ModerationAccountGuardrailPolicyRequest` + +```python +value: components.ModerationAccountGuardrailPolicyRequest = /* values here */ +``` + diff --git a/docs/components/accountguardrailpolicyresponse.mdx b/docs/components/accountguardrailpolicyresponse.mdx new file mode 100644 index 000000000..a6a51bb5d --- /dev/null +++ b/docs/components/accountguardrailpolicyresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "AccountGuardrailPolicyResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `data` | [components.AccountGuardrailPolicy](../components/accountguardrailpolicy.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/armor.mdx b/docs/components/armor.mdx new file mode 100644 index 000000000..efd05a13f --- /dev/null +++ b/docs/components/armor.mdx @@ -0,0 +1,12 @@ +--- +title: "Armor" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `classifier_context` | [Optional[components.ArmorContext]](../components/armorcontext.mdx) | ➖ | The Armor context: Claude Code's `classifier_context` (v1), with `auto_mode.{hard_deny,soft_deny,allow}` rules as strings or `{ id, instructions, threshold? }` objects and `auto_mode.environment` entries as `"Name: value"` strings or `{ name, value }` objects. `threshold` applies when Armor evaluates; when the provider evaluates natively (Anthropic dangerous-tool-use beta) rules are judged at the provider's own boundary. | \{
"auto_mode": \{
"allow": [],
"environment": [
"Trusted repo: github.com/acme/app"
],
"hard_deny": [],
"soft_deny": [
\{
"id": "secrets-in-vcs",
"instructions": "Staging, committing or pushing a file that holds secrets, including indirectly through git add -A when the tree shows one."
}
]
},
"v": 1
} | +| `mode` | [Optional[components.GuardrailModerationPolicyConfigMode]](../components/guardrailmoderationpolicyconfigmode.mdx) | ➖ | `enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`. | | +| `on_error` | [Optional[components.GuardrailModerationPolicyConfigOnError]](../components/guardrailmoderationpolicyconfigonerror.mdx) | ➖ | When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`. | | +| `use_cc_style_default_rules` | *Optional[bool]* | ➖ | Prepend Claude Code's built-in auto-mode rule set (1 hard-deny, 72 soft-deny, 17 allow, 21 environment slots) ahead of every configured rule. Defaults to true on the Anthropic Messages API and false elsewhere. | | \ No newline at end of file diff --git a/docs/components/armorplugin.mdx b/docs/components/armorplugin.mdx index d1281967c..27a96ad0b 100644 --- a/docs/components/armorplugin.mdx +++ b/docs/components/armorplugin.mdx @@ -14,6 +14,6 @@ Evaluates every client tool call the model emits against a rule stack (hard-deny | `evaluate_native_tools` | *Optional[bool]* | ➖ | Run provider-native server tools (web search, code execution, ...) through the agent loop so Armor evaluates them too. Defaults to false: native passthrough stands and such calls are reported `skipped`. | | | `id` | [components.ArmorPluginID](../components/armorpluginid.mdx) | ✔️ | N/A | | | `mode` | [Optional[components.ArmorPluginMode]](../components/armorpluginmode.mdx) | ➖ | `enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`. | | -| `on_error` | [Optional[components.OnError]](../components/onerror.mdx) | ➖ | When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`. | | +| `on_error` | [Optional[components.ArmorPluginOnError]](../components/armorpluginonerror.mdx) | ➖ | When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`. | | | `output_mode` | [Optional[components.OutputMode]](../components/outputmode.mdx) | ➖ | How a blocked call reaches the caller. `text` (the default): the call is withheld and an `` marker stands in assistant text. `custom_item` (Responses API only): the call is withheld and an `openrouter:armor_blocked` output item carries its id, name, arguments and the rule that fired. `claude_code_compatibility` (Messages API only; the default when the request carries a `dangerous_tool_use` safeguard, i.e. the client speaks Claude Code's protocol): the `tool_use` stays in `content[]` and the verdict is `flagged` in `safeguard_results`, so the client withholds execution and writes the error tool result as under the native classifier. Under `text` and `custom_item` the model received a failure result in the loop and continued in the same request; under `claude_code_compatibility` the turn ends on the flagged call and the model continues on the next request, after the client's denial. | | | `use_cc_style_default_rules` | *Optional[bool]* | ➖ | Prepend Claude Code's built-in auto-mode rule set (1 hard-deny, 72 soft-deny, 17 allow, 21 environment slots) ahead of every configured rule. Defaults to true on the Anthropic Messages API and false elsewhere. | | \ No newline at end of file diff --git a/docs/components/onerror.mdx b/docs/components/armorpluginonerror.mdx similarity index 77% rename from docs/components/onerror.mdx rename to docs/components/armorpluginonerror.mdx index fd5c6bab1..ca359faf0 100644 --- a/docs/components/onerror.mdx +++ b/docs/components/armorpluginonerror.mdx @@ -1,5 +1,5 @@ --- -title: "OnError" +title: "ArmorPluginOnError" --- When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`. @@ -7,10 +7,10 @@ When the classifier cannot answer (timeout, upstream error, context too long) th ## Example Usage ```python -from openrouter.components import OnError +from openrouter.components import ArmorPluginOnError # Open enum: unrecognized values are captured as UnrecognizedStr -value: OnError = "log" +value: ArmorPluginOnError = "log" ``` diff --git a/docs/components/budgetaccountguardrailpolicy.mdx b/docs/components/budgetaccountguardrailpolicy.mdx new file mode 100644 index 000000000..1d73f3e73 --- /dev/null +++ b/docs/components/budgetaccountguardrailpolicy.mdx @@ -0,0 +1,20 @@ +--- +title: "BudgetAccountGuardrailPolicy" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `config` | [components.GuardrailBudgetPolicyConfig](../components/guardrailbudgetpolicyconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `created_at` | *str* | ✔️ | N/A | 2025-08-24T10:30:00Z | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_default` | *bool* | ✔️ | N/A | | +| `is_synced` | *bool* | ✔️ | Kept in sync with a v1 guardrail; saving changes creates an account copy | | +| `is_workspace_default_synced` | *bool* | ✔️ | Synced from a v1 workspace default guardrail | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `policy_type` | [components.BudgetAccountGuardrailPolicyPolicyType](../components/budgetaccountguardrailpolicypolicytype.mdx) | ✔️ | N/A | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | +| `workspace_count` | *int* | ✔️ | N/A | | +| `workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/budgetaccountguardrailpolicypolicytype.mdx b/docs/components/budgetaccountguardrailpolicypolicytype.mdx new file mode 100644 index 000000000..973ef0ddc --- /dev/null +++ b/docs/components/budgetaccountguardrailpolicypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "BudgetAccountGuardrailPolicyPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import BudgetAccountGuardrailPolicyPolicyType +value: BudgetAccountGuardrailPolicyPolicyType = "budget" +``` + + +## Values + +- `"budget"` diff --git a/docs/components/budgetaccountguardrailpolicyrequest.mdx b/docs/components/budgetaccountguardrailpolicyrequest.mdx new file mode 100644 index 000000000..2ea323411 --- /dev/null +++ b/docs/components/budgetaccountguardrailpolicyrequest.mdx @@ -0,0 +1,17 @@ +--- +title: "BudgetAccountGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailBudgetPolicyAuthoringConfig](../components/guardrailbudgetpolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `floor_reassignment` | [Optional[components.BudgetAccountGuardrailPolicyRequestFloorReassignment]](../components/budgetaccountguardrailpolicyrequestfloorreassignment.mdx) | ➖ | Move workspaces off this policy onto another workspace-wide policy in the same write | | +| `is_default` | *Optional[bool]* | ➖ | Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it. | | +| `keep_previous_default_workspaces` | *Optional[bool]* | ➖ | Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`. | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_workspace_ids` | List[*str*] | ➖ | Workspaces left out of a default policy | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `policy_type` | [components.BudgetAccountGuardrailPolicyRequestPolicyType](../components/budgetaccountguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `released_floor_workspace_ids` | List[*str*] | ➖ | Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `workspace_ids` | List[*str*] | ➖ | Workspaces the policy covers when it is not the default | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/budgetaccountguardrailpolicyrequestfloorreassignment.mdx b/docs/components/budgetaccountguardrailpolicyrequestfloorreassignment.mdx new file mode 100644 index 000000000..d003d37df --- /dev/null +++ b/docs/components/budgetaccountguardrailpolicyrequestfloorreassignment.mdx @@ -0,0 +1,13 @@ +--- +title: "BudgetAccountGuardrailPolicyRequestFloorReassignment" +--- + +Move workspaces off this policy onto another workspace-wide policy in the same write + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `policy_id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/budgetaccountguardrailpolicyrequestpolicytype.mdx b/docs/components/budgetaccountguardrailpolicyrequestpolicytype.mdx new file mode 100644 index 000000000..e5f11ab24 --- /dev/null +++ b/docs/components/budgetaccountguardrailpolicyrequestpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "BudgetAccountGuardrailPolicyRequestPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import BudgetAccountGuardrailPolicyRequestPolicyType +value: BudgetAccountGuardrailPolicyRequestPolicyType = "budget" +``` + + +## Values + +- `"budget"` diff --git a/docs/components/budgetguardrailpolicy.mdx b/docs/components/budgetguardrailpolicy.mdx new file mode 100644 index 000000000..5b27e3753 --- /dev/null +++ b/docs/components/budgetguardrailpolicy.mdx @@ -0,0 +1,12 @@ +--- +title: "BudgetGuardrailPolicy" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailBudgetPolicyConfig](../components/guardrailbudgetpolicyconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.BudgetGuardrailPolicyPolicyType](../components/budgetguardrailpolicypolicytype.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/budgetguardrailpolicydetail.mdx b/docs/components/budgetguardrailpolicydetail.mdx new file mode 100644 index 000000000..47b074dc5 --- /dev/null +++ b/docs/components/budgetguardrailpolicydetail.mdx @@ -0,0 +1,22 @@ +--- +title: "BudgetGuardrailPolicyDetail" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `api_key_hashes` | List[*str*] | ✔️ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailBudgetPolicyConfig](../components/guardrailbudgetpolicyconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_workspace_default` | *Optional[bool]* | ➖ | N/A | | +| `member_ids` | List[*str*] | ✔️ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ✔️ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `overridden_api_key_hashes` | List[*str*] | ✔️ | API keys that have a different policy of this type assigned directly | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `overridden_member_ids` | List[*str*] | ➖ | Members that have a different policy of this type assigned directly | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `policy_type` | [components.BudgetGuardrailPolicyDetailPolicyType](../components/budgetguardrailpolicydetailpolicytype.mdx) | ✔️ | N/A | | +| `reference` | [OptionalNullable[components.BudgetGuardrailPolicyDetailReference]](../components/budgetguardrailpolicydetailreference.mdx) | ➖ | `legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null` | | +| `replaces_legacy_default` | *Optional[bool]* | ➖ | Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/budgetguardrailpolicydetailpolicytype.mdx b/docs/components/budgetguardrailpolicydetailpolicytype.mdx new file mode 100644 index 000000000..bcbb406dd --- /dev/null +++ b/docs/components/budgetguardrailpolicydetailpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "BudgetGuardrailPolicyDetailPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import BudgetGuardrailPolicyDetailPolicyType +value: BudgetGuardrailPolicyDetailPolicyType = "budget" +``` + + +## Values + +- `"budget"` diff --git a/docs/components/budgetguardrailpolicydetailreference.mdx b/docs/components/budgetguardrailpolicydetailreference.mdx new file mode 100644 index 000000000..902967572 --- /dev/null +++ b/docs/components/budgetguardrailpolicydetailreference.mdx @@ -0,0 +1,22 @@ +--- +title: "BudgetGuardrailPolicyDetailReference" +--- + +`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null` + +## Example Usage + +```python +from openrouter.components import BudgetGuardrailPolicyDetailReference + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: BudgetGuardrailPolicyDetailReference = "legacy_mapping" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"legacy_mapping"` +- `"account_default"` diff --git a/docs/components/budgetguardrailpolicydetailresponse.mdx b/docs/components/budgetguardrailpolicydetailresponse.mdx new file mode 100644 index 000000000..fb261a409 --- /dev/null +++ b/docs/components/budgetguardrailpolicydetailresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "BudgetGuardrailPolicyDetailResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `data` | [components.BudgetGuardrailPolicyDetail](../components/budgetguardrailpolicydetail.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/budgetguardrailpolicypolicytype.mdx b/docs/components/budgetguardrailpolicypolicytype.mdx new file mode 100644 index 000000000..2acdbedbf --- /dev/null +++ b/docs/components/budgetguardrailpolicypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "BudgetGuardrailPolicyPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import BudgetGuardrailPolicyPolicyType +value: BudgetGuardrailPolicyPolicyType = "budget" +``` + + +## Values + +- `"budget"` diff --git a/docs/components/budgetguardrailpolicyresponse.mdx b/docs/components/budgetguardrailpolicyresponse.mdx new file mode 100644 index 000000000..0f46656d4 --- /dev/null +++ b/docs/components/budgetguardrailpolicyresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "BudgetGuardrailPolicyResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `data` | [components.BudgetGuardrailPolicy](../components/budgetguardrailpolicy.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/budgetguardrailpolicysummary.mdx b/docs/components/budgetguardrailpolicysummary.mdx new file mode 100644 index 000000000..aa70ee8e5 --- /dev/null +++ b/docs/components/budgetguardrailpolicysummary.mdx @@ -0,0 +1,19 @@ +--- +title: "BudgetGuardrailPolicySummary" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `api_key_count` | *int* | ✔️ | N/A | | +| `config` | [components.GuardrailBudgetPolicyConfig](../components/guardrailbudgetpolicyconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_legacy_mapped` | *Optional[bool]* | ➖ | Whether the policy is kept in sync with a v1 guardrail | | +| `is_workspace_default` | *Optional[bool]* | ➖ | N/A | | +| `legacy_guardrail_ids` | List[*str*] | ➖ | IDs of the v1 guardrails this policy was migrated from | | +| `member_count` | *int* | ✔️ | N/A | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.BudgetGuardrailPolicySummaryPolicyType](../components/budgetguardrailpolicysummarypolicytype.mdx) | ✔️ | N/A | | +| `replaced_legacy_guardrail_ids` | List[*str*] | ➖ | IDs of the v1 guardrails this policy replaced | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/budgetguardrailpolicysummarypolicytype.mdx b/docs/components/budgetguardrailpolicysummarypolicytype.mdx new file mode 100644 index 000000000..52cff38bc --- /dev/null +++ b/docs/components/budgetguardrailpolicysummarypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "BudgetGuardrailPolicySummaryPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import BudgetGuardrailPolicySummaryPolicyType +value: BudgetGuardrailPolicySummaryPolicyType = "budget" +``` + + +## Values + +- `"budget"` diff --git a/docs/components/changeguardrailpolicyassignmentrequest.mdx b/docs/components/changeguardrailpolicyassignmentrequest.mdx new file mode 100644 index 000000000..f6d576cac --- /dev/null +++ b/docs/components/changeguardrailpolicyassignmentrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "ChangeGuardrailPolicyAssignmentRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `assigned` | *bool* | ✔️ | `true` assigns the policy to the subject, `false` removes it | true | +| `expected_assignment` | [components.GuardrailPolicyAssignmentState](../components/guardrailpolicyassignmentstate.mdx) | ✔️ | N/A | | +| `policy_id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `policy_type` | [components.ChangeGuardrailPolicyAssignmentRequestPolicyType](../components/changeguardrailpolicyassignmentrequestpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for | budget | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/changeguardrailpolicyassignmentrequestpolicytype.mdx b/docs/components/changeguardrailpolicyassignmentrequestpolicytype.mdx new file mode 100644 index 000000000..36dea9cb8 --- /dev/null +++ b/docs/components/changeguardrailpolicyassignmentrequestpolicytype.mdx @@ -0,0 +1,24 @@ +--- +title: "ChangeGuardrailPolicyAssignmentRequestPolicyType" +--- + +Policy type the assignment is read or changed for + +## Example Usage + +```python +from openrouter.components import ChangeGuardrailPolicyAssignmentRequestPolicyType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ChangeGuardrailPolicyAssignmentRequestPolicyType = "budget" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"budget"` +- `"model_availability"` +- `"moderation"` +- `"rate_limit"` diff --git a/docs/components/changeguardrailpolicyassignmentresponse.mdx b/docs/components/changeguardrailpolicyassignmentresponse.mdx new file mode 100644 index 000000000..b6b4b26bc --- /dev/null +++ b/docs/components/changeguardrailpolicyassignmentresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ChangeGuardrailPolicyAssignmentResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | +| `data` | *bool* | ✔️ | Whether the assignment changed | true | \ No newline at end of file diff --git a/docs/components/contentfilter.mdx b/docs/components/contentfilter.mdx new file mode 100644 index 000000000..325719352 --- /dev/null +++ b/docs/components/contentfilter.mdx @@ -0,0 +1,11 @@ +--- +title: "ContentFilter" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `action` | [components.GuardrailModerationPolicyConfigContentFilterAction](../components/guardrailmoderationpolicyconfigcontentfilteraction.mdx) | ✔️ | N/A | +| `label` | *OptionalNullable[str]* | ➖ | N/A | +| `pattern` | *str* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/contentfilterbuiltin.mdx b/docs/components/contentfilterbuiltin.mdx new file mode 100644 index 000000000..d7d2aaf81 --- /dev/null +++ b/docs/components/contentfilterbuiltin.mdx @@ -0,0 +1,12 @@ +--- +title: "ContentFilterBuiltin" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `action` | [components.GuardrailModerationPolicyConfigContentFilterBuiltinAction](../components/guardrailmoderationpolicyconfigcontentfilterbuiltinaction.mdx) | ✔️ | N/A | +| `label` | *Optional[str]* | ➖ | N/A | +| `scan_scope` | [Optional[components.ScanScope]](../components/scanscope.mdx) | ➖ | N/A | +| `slug` | [components.Slug](../components/slug.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/createbudgetguardrailpolicyrequest.mdx b/docs/components/createbudgetguardrailpolicyrequest.mdx new file mode 100644 index 000000000..159383d92 --- /dev/null +++ b/docs/components/createbudgetguardrailpolicyrequest.mdx @@ -0,0 +1,17 @@ +--- +title: "CreateBudgetGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailBudgetPolicyAuthoringConfig](../components/guardrailbudgetpolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `is_workspace_default` | *Optional[bool]* | ➖ | Make this the workspace default for its policy type. Defaults to `false`. | | +| `member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API keys that should not inherit the policy when it is the workspace default | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Members that should not inherit the policy when it is the workspace default | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `policy_type` | [components.CreateBudgetGuardrailPolicyRequestPolicyType](../components/createbudgetguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/createbudgetguardrailpolicyrequestpolicytype.mdx b/docs/components/createbudgetguardrailpolicyrequestpolicytype.mdx new file mode 100644 index 000000000..75d065626 --- /dev/null +++ b/docs/components/createbudgetguardrailpolicyrequestpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "CreateBudgetGuardrailPolicyRequestPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import CreateBudgetGuardrailPolicyRequestPolicyType +value: CreateBudgetGuardrailPolicyRequestPolicyType = "budget" +``` + + +## Values + +- `"budget"` diff --git a/docs/components/createmodelavailabilityguardrailpolicyrequest.mdx b/docs/components/createmodelavailabilityguardrailpolicyrequest.mdx new file mode 100644 index 000000000..1232d172f --- /dev/null +++ b/docs/components/createmodelavailabilityguardrailpolicyrequest.mdx @@ -0,0 +1,17 @@ +--- +title: "CreateModelAvailabilityGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailModelAvailabilityPolicyAuthoringConfig](../components/guardrailmodelavailabilitypolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `is_workspace_default` | *Optional[bool]* | ➖ | Make this the workspace default for its policy type. Defaults to `false`. | | +| `member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API keys that should not inherit the policy when it is the workspace default | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Members that should not inherit the policy when it is the workspace default | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `policy_type` | [components.CreateModelAvailabilityGuardrailPolicyRequestPolicyType](../components/createmodelavailabilityguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/createmodelavailabilityguardrailpolicyrequestpolicytype.mdx b/docs/components/createmodelavailabilityguardrailpolicyrequestpolicytype.mdx new file mode 100644 index 000000000..bd2d34bf9 --- /dev/null +++ b/docs/components/createmodelavailabilityguardrailpolicyrequestpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "CreateModelAvailabilityGuardrailPolicyRequestPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import CreateModelAvailabilityGuardrailPolicyRequestPolicyType +value: CreateModelAvailabilityGuardrailPolicyRequestPolicyType = "model_availability" +``` + + +## Values + +- `"model_availability"` diff --git a/docs/components/createmoderationguardrailpolicyrequest.mdx b/docs/components/createmoderationguardrailpolicyrequest.mdx new file mode 100644 index 000000000..6aa3e42c7 --- /dev/null +++ b/docs/components/createmoderationguardrailpolicyrequest.mdx @@ -0,0 +1,17 @@ +--- +title: "CreateModerationGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailModerationPolicyConfig](../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `is_workspace_default` | *Optional[bool]* | ➖ | Make this the workspace default for its policy type. Defaults to `false`. | | +| `member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API keys that should not inherit the policy when it is the workspace default | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Members that should not inherit the policy when it is the workspace default | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `policy_type` | [components.CreateModerationGuardrailPolicyRequestPolicyType](../components/createmoderationguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/createmoderationguardrailpolicyrequestpolicytype.mdx b/docs/components/createmoderationguardrailpolicyrequestpolicytype.mdx new file mode 100644 index 000000000..c95bbced6 --- /dev/null +++ b/docs/components/createmoderationguardrailpolicyrequestpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "CreateModerationGuardrailPolicyRequestPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import CreateModerationGuardrailPolicyRequestPolicyType +value: CreateModerationGuardrailPolicyRequestPolicyType = "moderation" +``` + + +## Values + +- `"moderation"` diff --git a/docs/components/deleteguardrailpolicyresponse.mdx b/docs/components/deleteguardrailpolicyresponse.mdx new file mode 100644 index 000000000..65e93e684 --- /dev/null +++ b/docs/components/deleteguardrailpolicyresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "DeleteGuardrailPolicyResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | +| `data` | *bool* | ✔️ | Whether the policy was deleted | true | \ No newline at end of file diff --git a/docs/components/guardrailbudgetpolicyauthoringconfig.mdx b/docs/components/guardrailbudgetpolicyauthoringconfig.mdx new file mode 100644 index 000000000..a90f9e24f --- /dev/null +++ b/docs/components/guardrailbudgetpolicyauthoringconfig.mdx @@ -0,0 +1,11 @@ +--- +title: "GuardrailBudgetPolicyAuthoringConfig" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | +| `include_byok_in_budgets` | *bool* | ✔️ | N/A | +| `limit_usd` | *Nullable[float]* | ✔️ | N/A | +| `reset_interval` | [Nullable[components.GuardrailBudgetPolicyAuthoringConfigResetInterval]](../components/guardrailbudgetpolicyauthoringconfigresetinterval.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/guardrailbudgetpolicyauthoringconfigresetinterval.mdx b/docs/components/guardrailbudgetpolicyauthoringconfigresetinterval.mdx new file mode 100644 index 000000000..2bfbc780e --- /dev/null +++ b/docs/components/guardrailbudgetpolicyauthoringconfigresetinterval.mdx @@ -0,0 +1,21 @@ +--- +title: "GuardrailBudgetPolicyAuthoringConfigResetInterval" +--- + +## Example Usage + +```python +from openrouter.components import GuardrailBudgetPolicyAuthoringConfigResetInterval + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GuardrailBudgetPolicyAuthoringConfigResetInterval = "daily" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"daily"` +- `"weekly"` +- `"monthly"` diff --git a/docs/components/guardrailbudgetpolicyconfig.mdx b/docs/components/guardrailbudgetpolicyconfig.mdx new file mode 100644 index 000000000..53a7745e8 --- /dev/null +++ b/docs/components/guardrailbudgetpolicyconfig.mdx @@ -0,0 +1,11 @@ +--- +title: "GuardrailBudgetPolicyConfig" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `include_byok_in_budgets` | *Optional[bool]* | ➖ | Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false. | false | +| `limit_usd` | *OptionalNullable[float]* | ➖ | Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400. | 50 | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly | \ No newline at end of file diff --git a/docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx b/docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx new file mode 100644 index 000000000..5d929f0ba --- /dev/null +++ b/docs/components/guardrailmodelavailabilitypolicyauthoringconfig.mdx @@ -0,0 +1,29 @@ +--- +title: "GuardrailModelAvailabilityPolicyAuthoringConfig" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | N/A | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | N/A | +| `allowed_data_regions` | List[*str*] | ➖ | N/A | +| `allowed_models` | List[*str*] | ➖ | N/A | +| `allowed_providers` | List[*str*] | ➖ | N/A | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | N/A | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | N/A | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | N/A | +| `ignored_models` | List[*str*] | ➖ | N/A | +| `ignored_providers` | List[*str*] | ➖ | N/A | +| `platform_banned_authors` | List[*str*] | ➖ | N/A | +| `platform_banned_models` | List[*str*] | ➖ | N/A | +| `platform_banned_providers` | List[*str*] | ➖ | N/A | +| `require_eu_data_region` | *OptionalNullable[bool]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/guardrailmodelavailabilitypolicyconfig.mdx b/docs/components/guardrailmodelavailabilitypolicyconfig.mdx new file mode 100644 index 000000000..0090c1faf --- /dev/null +++ b/docs/components/guardrailmodelavailabilitypolicyconfig.mdx @@ -0,0 +1,29 @@ +--- +title: "GuardrailModelAvailabilityPolicyConfig" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `allow_safety_retention_google` | *OptionalNullable[bool]* | ➖ | N/A | +| `allow_safety_retention_other` | *OptionalNullable[bool]* | ➖ | N/A | +| `allowed_data_regions` | List[*str*] | ➖ | N/A | +| `allowed_models` | List[*str*] | ➖ | N/A | +| `allowed_providers` | List[*str*] | ➖ | N/A | +| `enable_free_model_publication` | *OptionalNullable[bool]* | ➖ | N/A | +| `enable_free_model_training` | *OptionalNullable[bool]* | ➖ | N/A | +| `enable_paid_model_training` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_first_party_harness_models` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_google` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_other` | *OptionalNullable[bool]* | ➖ | N/A | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | ➖ | N/A | +| `ignored_models` | List[*str*] | ➖ | N/A | +| `ignored_providers` | List[*str*] | ➖ | N/A | +| `platform_banned_authors` | List[*str*] | ➖ | N/A | +| `platform_banned_models` | List[*str*] | ➖ | N/A | +| `platform_banned_providers` | List[*str*] | ➖ | N/A | +| `require_eu_data_region` | *OptionalNullable[bool]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/guardrailmoderationpolicyconfig.mdx b/docs/components/guardrailmoderationpolicyconfig.mdx new file mode 100644 index 000000000..edbdf4ccd --- /dev/null +++ b/docs/components/guardrailmoderationpolicyconfig.mdx @@ -0,0 +1,21 @@ +--- +title: "GuardrailModerationPolicyConfig" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `armor` | [OptionalNullable[components.Armor]](../components/armor.mdx) | ➖ | N/A | +| `broadcast_model_armor_flagged_requests` | *OptionalNullable[bool]* | ➖ | N/A | +| `content_filter_blocks_requests` | *Optional[bool]* | ➖ | N/A | +| `content_filter_builtins` | List[[components.ContentFilterBuiltin](../components/contentfilterbuiltin.mdx)] | ➖ | N/A | +| `content_filter_patterns` | List[*str*] | ➖ | N/A | +| `content_filters` | List[[components.ContentFilter](../components/contentfilter.mdx)] | ➖ | N/A | +| `enable_model_armor_injection_protection` | *OptionalNullable[bool]* | ➖ | N/A | +| `lakera_injection_protection_mode` | [OptionalNullable[components.LakeraInjectionProtectionMode]](../components/lakerainjectionprotectionmode.mdx) | ➖ | N/A | +| `model_armor_injection_confidence_level` | [Optional[components.ModelArmorInjectionConfidenceLevel]](../components/modelarmorinjectionconfidencelevel.mdx) | ➖ | N/A | +| `model_armor_injection_protection_mode` | [OptionalNullable[components.ModelArmorInjectionProtectionMode]](../components/modelarmorinjectionprotectionmode.mdx) | ➖ | N/A | +| `pii_filters` | List[[components.PiiFilter](../components/piifilter.mdx)] | ➖ | N/A | +| `platform_image_moderated_providers` | List[*str*] | ➖ | N/A | +| `platform_moderated_providers` | List[*str*] | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/guardrailmoderationpolicyconfigcontentfilteraction.mdx b/docs/components/guardrailmoderationpolicyconfigcontentfilteraction.mdx new file mode 100644 index 000000000..6972266ee --- /dev/null +++ b/docs/components/guardrailmoderationpolicyconfigcontentfilteraction.mdx @@ -0,0 +1,21 @@ +--- +title: "GuardrailModerationPolicyConfigContentFilterAction" +--- + +## Example Usage + +```python +from openrouter.components import GuardrailModerationPolicyConfigContentFilterAction + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GuardrailModerationPolicyConfigContentFilterAction = "redact" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"redact"` +- `"block"` +- `"flag"` diff --git a/docs/components/guardrailmoderationpolicyconfigcontentfilterbuiltinaction.mdx b/docs/components/guardrailmoderationpolicyconfigcontentfilterbuiltinaction.mdx new file mode 100644 index 000000000..b16646b4e --- /dev/null +++ b/docs/components/guardrailmoderationpolicyconfigcontentfilterbuiltinaction.mdx @@ -0,0 +1,21 @@ +--- +title: "GuardrailModerationPolicyConfigContentFilterBuiltinAction" +--- + +## Example Usage + +```python +from openrouter.components import GuardrailModerationPolicyConfigContentFilterBuiltinAction + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GuardrailModerationPolicyConfigContentFilterBuiltinAction = "redact" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"redact"` +- `"block"` +- `"flag"` diff --git a/docs/components/guardrailmoderationpolicyconfigmode.mdx b/docs/components/guardrailmoderationpolicyconfigmode.mdx new file mode 100644 index 000000000..0eaa11a96 --- /dev/null +++ b/docs/components/guardrailmoderationpolicyconfigmode.mdx @@ -0,0 +1,22 @@ +--- +title: "GuardrailModerationPolicyConfigMode" +--- + +`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`. + +## Example Usage + +```python +from openrouter.components import GuardrailModerationPolicyConfigMode + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GuardrailModerationPolicyConfigMode = "enforce" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"enforce"` +- `"audit"` diff --git a/docs/components/guardrailmoderationpolicyconfigonerror.mdx b/docs/components/guardrailmoderationpolicyconfigonerror.mdx new file mode 100644 index 000000000..60e882e0b --- /dev/null +++ b/docs/components/guardrailmoderationpolicyconfigonerror.mdx @@ -0,0 +1,22 @@ +--- +title: "GuardrailModerationPolicyConfigOnError" +--- + +When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`. + +## Example Usage + +```python +from openrouter.components import GuardrailModerationPolicyConfigOnError + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GuardrailModerationPolicyConfigOnError = "log" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"log"` +- `"block"` diff --git a/docs/components/guardrailpolicyassignmentresponse.mdx b/docs/components/guardrailpolicyassignmentresponse.mdx new file mode 100644 index 000000000..1aa50c155 --- /dev/null +++ b/docs/components/guardrailpolicyassignmentresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "GuardrailPolicyAssignmentResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `data` | [components.GuardrailPolicyAssignmentState](../components/guardrailpolicyassignmentstate.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/guardrailpolicyassignmentstate.mdx b/docs/components/guardrailpolicyassignmentstate.mdx new file mode 100644 index 000000000..39e4bb8c3 --- /dev/null +++ b/docs/components/guardrailpolicyassignmentstate.mdx @@ -0,0 +1,11 @@ +--- +title: "GuardrailPolicyAssignmentState" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `opted_out` | *bool* | ✔️ | Whether the subject is opted out of the workspace default | false | +| `policy_ids` | List[*str*] | ✔️ | Policies of this type assigned directly to the subject | [] | +| `workspace_default_policy_ids` | List[*str*] | ✔️ | Workspace default policies of this type the subject inherits | [
"2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90"
] | \ No newline at end of file diff --git a/docs/components/lakerainjectionprotectionmode.mdx b/docs/components/lakerainjectionprotectionmode.mdx new file mode 100644 index 000000000..c92f2ad3b --- /dev/null +++ b/docs/components/lakerainjectionprotectionmode.mdx @@ -0,0 +1,20 @@ +--- +title: "LakeraInjectionProtectionMode" +--- + +## Example Usage + +```python +from openrouter.components import LakeraInjectionProtectionMode + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: LakeraInjectionProtectionMode = "block" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"block"` +- `"flag"` diff --git a/docs/components/listaccountguardrailpoliciesresponse.mdx b/docs/components/listaccountguardrailpoliciesresponse.mdx new file mode 100644 index 000000000..733793a12 --- /dev/null +++ b/docs/components/listaccountguardrailpoliciesresponse.mdx @@ -0,0 +1,10 @@ +--- +title: "ListAccountGuardrailPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `data` | List[[components.AccountGuardrailPolicy](../components/accountguardrailpolicy.mdx)] | ✔️ | N/A | | +| `total_count` | *int* | ✔️ | Total number of policies | 1 | \ No newline at end of file diff --git a/docs/components/listbudgetguardrailpoliciesresponse.mdx b/docs/components/listbudgetguardrailpoliciesresponse.mdx new file mode 100644 index 000000000..bd4f3fcc8 --- /dev/null +++ b/docs/components/listbudgetguardrailpoliciesresponse.mdx @@ -0,0 +1,10 @@ +--- +title: "ListBudgetGuardrailPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `data` | List[[components.BudgetGuardrailPolicySummary](../components/budgetguardrailpolicysummary.mdx)] | ✔️ | N/A | | +| `total_count` | *int* | ✔️ | Total number of policies | 1 | \ No newline at end of file diff --git a/docs/components/listmodelavailabilityguardrailpoliciesresponse.mdx b/docs/components/listmodelavailabilityguardrailpoliciesresponse.mdx new file mode 100644 index 000000000..9d4b742f7 --- /dev/null +++ b/docs/components/listmodelavailabilityguardrailpoliciesresponse.mdx @@ -0,0 +1,10 @@ +--- +title: "ListModelAvailabilityGuardrailPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `data` | List[[components.ModelAvailabilityGuardrailPolicySummary](../components/modelavailabilityguardrailpolicysummary.mdx)] | ✔️ | N/A | | +| `total_count` | *int* | ✔️ | Total number of policies | 1 | \ No newline at end of file diff --git a/docs/components/listmoderationguardrailpoliciesresponse.mdx b/docs/components/listmoderationguardrailpoliciesresponse.mdx new file mode 100644 index 000000000..ac61c54c5 --- /dev/null +++ b/docs/components/listmoderationguardrailpoliciesresponse.mdx @@ -0,0 +1,10 @@ +--- +title: "ListModerationGuardrailPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `data` | List[[components.ModerationGuardrailPolicySummary](../components/moderationguardrailpolicysummary.mdx)] | ✔️ | N/A | | +| `total_count` | *int* | ✔️ | Total number of policies | 1 | \ No newline at end of file diff --git a/docs/components/modelarmorinjectionconfidencelevel.mdx b/docs/components/modelarmorinjectionconfidencelevel.mdx new file mode 100644 index 000000000..35fcd9566 --- /dev/null +++ b/docs/components/modelarmorinjectionconfidencelevel.mdx @@ -0,0 +1,21 @@ +--- +title: "ModelArmorInjectionConfidenceLevel" +--- + +## Example Usage + +```python +from openrouter.components import ModelArmorInjectionConfidenceLevel + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ModelArmorInjectionConfidenceLevel = "low" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"low"` +- `"medium"` +- `"high"` diff --git a/docs/components/modelarmorinjectionprotectionmode.mdx b/docs/components/modelarmorinjectionprotectionmode.mdx new file mode 100644 index 000000000..093486e3c --- /dev/null +++ b/docs/components/modelarmorinjectionprotectionmode.mdx @@ -0,0 +1,20 @@ +--- +title: "ModelArmorInjectionProtectionMode" +--- + +## Example Usage + +```python +from openrouter.components import ModelArmorInjectionProtectionMode + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ModelArmorInjectionProtectionMode = "block" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"block"` +- `"flag"` diff --git a/docs/components/modelavailabilityaccountguardrailpolicy.mdx b/docs/components/modelavailabilityaccountguardrailpolicy.mdx new file mode 100644 index 000000000..7835ef234 --- /dev/null +++ b/docs/components/modelavailabilityaccountguardrailpolicy.mdx @@ -0,0 +1,20 @@ +--- +title: "ModelAvailabilityAccountGuardrailPolicy" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailModelAvailabilityPolicyConfig](../components/guardrailmodelavailabilitypolicyconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `created_at` | *str* | ✔️ | N/A | 2025-08-24T10:30:00Z | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_default` | *bool* | ✔️ | N/A | | +| `is_synced` | *bool* | ✔️ | Kept in sync with a v1 guardrail; saving changes creates an account copy | | +| `is_workspace_default_synced` | *bool* | ✔️ | Synced from a v1 workspace default guardrail | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `policy_type` | [components.ModelAvailabilityAccountGuardrailPolicyPolicyType](../components/modelavailabilityaccountguardrailpolicypolicytype.mdx) | ✔️ | N/A | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | +| `workspace_count` | *int* | ✔️ | N/A | | +| `workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/modelavailabilityaccountguardrailpolicypolicytype.mdx b/docs/components/modelavailabilityaccountguardrailpolicypolicytype.mdx new file mode 100644 index 000000000..0036e91e9 --- /dev/null +++ b/docs/components/modelavailabilityaccountguardrailpolicypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModelAvailabilityAccountGuardrailPolicyPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModelAvailabilityAccountGuardrailPolicyPolicyType +value: ModelAvailabilityAccountGuardrailPolicyPolicyType = "model_availability" +``` + + +## Values + +- `"model_availability"` diff --git a/docs/components/modelavailabilityaccountguardrailpolicyrequest.mdx b/docs/components/modelavailabilityaccountguardrailpolicyrequest.mdx new file mode 100644 index 000000000..4f2baabad --- /dev/null +++ b/docs/components/modelavailabilityaccountguardrailpolicyrequest.mdx @@ -0,0 +1,17 @@ +--- +title: "ModelAvailabilityAccountGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailModelAvailabilityPolicyAuthoringConfig](../components/guardrailmodelavailabilitypolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `floor_reassignment` | [Optional[components.ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignment]](../components/modelavailabilityaccountguardrailpolicyrequestfloorreassignment.mdx) | ➖ | Move workspaces off this policy onto another workspace-wide policy in the same write | | +| `is_default` | *Optional[bool]* | ➖ | Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it. | | +| `keep_previous_default_workspaces` | *Optional[bool]* | ➖ | Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`. | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_workspace_ids` | List[*str*] | ➖ | Workspaces left out of a default policy | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `policy_type` | [components.ModelAvailabilityAccountGuardrailPolicyRequestPolicyType](../components/modelavailabilityaccountguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `released_floor_workspace_ids` | List[*str*] | ➖ | Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `workspace_ids` | List[*str*] | ➖ | Workspaces the policy covers when it is not the default | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/modelavailabilityaccountguardrailpolicyrequestfloorreassignment.mdx b/docs/components/modelavailabilityaccountguardrailpolicyrequestfloorreassignment.mdx new file mode 100644 index 000000000..30d9bff41 --- /dev/null +++ b/docs/components/modelavailabilityaccountguardrailpolicyrequestfloorreassignment.mdx @@ -0,0 +1,13 @@ +--- +title: "ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignment" +--- + +Move workspaces off this policy onto another workspace-wide policy in the same write + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `policy_id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/modelavailabilityaccountguardrailpolicyrequestpolicytype.mdx b/docs/components/modelavailabilityaccountguardrailpolicyrequestpolicytype.mdx new file mode 100644 index 000000000..d63e1f0f1 --- /dev/null +++ b/docs/components/modelavailabilityaccountguardrailpolicyrequestpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModelAvailabilityAccountGuardrailPolicyRequestPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModelAvailabilityAccountGuardrailPolicyRequestPolicyType +value: ModelAvailabilityAccountGuardrailPolicyRequestPolicyType = "model_availability" +``` + + +## Values + +- `"model_availability"` diff --git a/docs/components/modelavailabilityguardrailpolicy.mdx b/docs/components/modelavailabilityguardrailpolicy.mdx new file mode 100644 index 000000000..b58d4ff78 --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicy.mdx @@ -0,0 +1,12 @@ +--- +title: "ModelAvailabilityGuardrailPolicy" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailModelAvailabilityPolicyConfig](../components/guardrailmodelavailabilitypolicyconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.ModelAvailabilityGuardrailPolicyPolicyType](../components/modelavailabilityguardrailpolicypolicytype.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/modelavailabilityguardrailpolicydetail.mdx b/docs/components/modelavailabilityguardrailpolicydetail.mdx new file mode 100644 index 000000000..adfcfaef9 --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicydetail.mdx @@ -0,0 +1,22 @@ +--- +title: "ModelAvailabilityGuardrailPolicyDetail" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_key_hashes` | List[*str*] | ✔️ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailModelAvailabilityPolicyConfig](../components/guardrailmodelavailabilitypolicyconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_workspace_default` | *Optional[bool]* | ➖ | N/A | | +| `member_ids` | List[*str*] | ✔️ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ✔️ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `overridden_api_key_hashes` | List[*str*] | ✔️ | API keys that have a different policy of this type assigned directly | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `overridden_member_ids` | List[*str*] | ➖ | Members that have a different policy of this type assigned directly | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `policy_type` | [components.ModelAvailabilityGuardrailPolicyDetailPolicyType](../components/modelavailabilityguardrailpolicydetailpolicytype.mdx) | ✔️ | N/A | | +| `reference` | [OptionalNullable[components.ModelAvailabilityGuardrailPolicyDetailReference]](../components/modelavailabilityguardrailpolicydetailreference.mdx) | ➖ | `legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null` | | +| `replaces_legacy_default` | *Optional[bool]* | ➖ | Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/modelavailabilityguardrailpolicydetailpolicytype.mdx b/docs/components/modelavailabilityguardrailpolicydetailpolicytype.mdx new file mode 100644 index 000000000..7fc4b61ab --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicydetailpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModelAvailabilityGuardrailPolicyDetailPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModelAvailabilityGuardrailPolicyDetailPolicyType +value: ModelAvailabilityGuardrailPolicyDetailPolicyType = "model_availability" +``` + + +## Values + +- `"model_availability"` diff --git a/docs/components/modelavailabilityguardrailpolicydetailreference.mdx b/docs/components/modelavailabilityguardrailpolicydetailreference.mdx new file mode 100644 index 000000000..a86d9d909 --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicydetailreference.mdx @@ -0,0 +1,22 @@ +--- +title: "ModelAvailabilityGuardrailPolicyDetailReference" +--- + +`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null` + +## Example Usage + +```python +from openrouter.components import ModelAvailabilityGuardrailPolicyDetailReference + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ModelAvailabilityGuardrailPolicyDetailReference = "legacy_mapping" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"legacy_mapping"` +- `"account_default"` diff --git a/docs/components/modelavailabilityguardrailpolicydetailresponse.mdx b/docs/components/modelavailabilityguardrailpolicydetailresponse.mdx new file mode 100644 index 000000000..caa765235 --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicydetailresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ModelAvailabilityGuardrailPolicyDetailResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `data` | [components.ModelAvailabilityGuardrailPolicyDetail](../components/modelavailabilityguardrailpolicydetail.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/modelavailabilityguardrailpolicypolicytype.mdx b/docs/components/modelavailabilityguardrailpolicypolicytype.mdx new file mode 100644 index 000000000..bf84bcc1e --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModelAvailabilityGuardrailPolicyPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModelAvailabilityGuardrailPolicyPolicyType +value: ModelAvailabilityGuardrailPolicyPolicyType = "model_availability" +``` + + +## Values + +- `"model_availability"` diff --git a/docs/components/modelavailabilityguardrailpolicyresponse.mdx b/docs/components/modelavailabilityguardrailpolicyresponse.mdx new file mode 100644 index 000000000..85a9a5dca --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicyresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ModelAvailabilityGuardrailPolicyResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `data` | [components.ModelAvailabilityGuardrailPolicy](../components/modelavailabilityguardrailpolicy.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/modelavailabilityguardrailpolicysummary.mdx b/docs/components/modelavailabilityguardrailpolicysummary.mdx new file mode 100644 index 000000000..ee7c403b5 --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicysummary.mdx @@ -0,0 +1,19 @@ +--- +title: "ModelAvailabilityGuardrailPolicySummary" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_key_count` | *int* | ✔️ | N/A | | +| `config` | [components.GuardrailModelAvailabilityPolicyConfig](../components/guardrailmodelavailabilitypolicyconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_legacy_mapped` | *Optional[bool]* | ➖ | Whether the policy is kept in sync with a v1 guardrail | | +| `is_workspace_default` | *Optional[bool]* | ➖ | N/A | | +| `legacy_guardrail_ids` | List[*str*] | ➖ | IDs of the v1 guardrails this policy was migrated from | | +| `member_count` | *int* | ✔️ | N/A | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.ModelAvailabilityGuardrailPolicySummaryPolicyType](../components/modelavailabilityguardrailpolicysummarypolicytype.mdx) | ✔️ | N/A | | +| `replaced_legacy_guardrail_ids` | List[*str*] | ➖ | IDs of the v1 guardrails this policy replaced | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/modelavailabilityguardrailpolicysummarypolicytype.mdx b/docs/components/modelavailabilityguardrailpolicysummarypolicytype.mdx new file mode 100644 index 000000000..aa249e0b8 --- /dev/null +++ b/docs/components/modelavailabilityguardrailpolicysummarypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModelAvailabilityGuardrailPolicySummaryPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModelAvailabilityGuardrailPolicySummaryPolicyType +value: ModelAvailabilityGuardrailPolicySummaryPolicyType = "model_availability" +``` + + +## Values + +- `"model_availability"` diff --git a/docs/components/moderationaccountguardrailpolicy.mdx b/docs/components/moderationaccountguardrailpolicy.mdx new file mode 100644 index 000000000..b64ae3107 --- /dev/null +++ b/docs/components/moderationaccountguardrailpolicy.mdx @@ -0,0 +1,20 @@ +--- +title: "ModerationAccountGuardrailPolicy" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailModerationPolicyConfig](../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `created_at` | *str* | ✔️ | N/A | 2025-08-24T10:30:00Z | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_default` | *bool* | ✔️ | N/A | | +| `is_synced` | *bool* | ✔️ | Kept in sync with a v1 guardrail; saving changes creates an account copy | | +| `is_workspace_default_synced` | *bool* | ✔️ | Synced from a v1 workspace default guardrail | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `policy_type` | [components.ModerationAccountGuardrailPolicyPolicyType](../components/moderationaccountguardrailpolicypolicytype.mdx) | ✔️ | N/A | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | +| `workspace_count` | *int* | ✔️ | N/A | | +| `workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/moderationaccountguardrailpolicypolicytype.mdx b/docs/components/moderationaccountguardrailpolicypolicytype.mdx new file mode 100644 index 000000000..fc9a40762 --- /dev/null +++ b/docs/components/moderationaccountguardrailpolicypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModerationAccountGuardrailPolicyPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModerationAccountGuardrailPolicyPolicyType +value: ModerationAccountGuardrailPolicyPolicyType = "moderation" +``` + + +## Values + +- `"moderation"` diff --git a/docs/components/moderationaccountguardrailpolicyrequest.mdx b/docs/components/moderationaccountguardrailpolicyrequest.mdx new file mode 100644 index 000000000..605e3f5e5 --- /dev/null +++ b/docs/components/moderationaccountguardrailpolicyrequest.mdx @@ -0,0 +1,17 @@ +--- +title: "ModerationAccountGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailModerationPolicyConfig](../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `floor_reassignment` | [Optional[components.ModerationAccountGuardrailPolicyRequestFloorReassignment]](../components/moderationaccountguardrailpolicyrequestfloorreassignment.mdx) | ➖ | Move workspaces off this policy onto another workspace-wide policy in the same write | | +| `is_default` | *Optional[bool]* | ➖ | Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it. | | +| `keep_previous_default_workspaces` | *Optional[bool]* | ➖ | Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`. | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_workspace_ids` | List[*str*] | ➖ | Workspaces left out of a default policy | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `policy_type` | [components.ModerationAccountGuardrailPolicyRequestPolicyType](../components/moderationaccountguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `released_floor_workspace_ids` | List[*str*] | ➖ | Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | +| `workspace_ids` | List[*str*] | ➖ | Workspaces the policy covers when it is not the default | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/moderationaccountguardrailpolicyrequestfloorreassignment.mdx b/docs/components/moderationaccountguardrailpolicyrequestfloorreassignment.mdx new file mode 100644 index 000000000..c5a168782 --- /dev/null +++ b/docs/components/moderationaccountguardrailpolicyrequestfloorreassignment.mdx @@ -0,0 +1,13 @@ +--- +title: "ModerationAccountGuardrailPolicyRequestFloorReassignment" +--- + +Move workspaces off this policy onto another workspace-wide policy in the same write + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `policy_id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_ids` | List[*str*] | ✔️ | N/A | [
"0df9e665-d932-5740-b2c7-b52af166bc11"
] | \ No newline at end of file diff --git a/docs/components/moderationaccountguardrailpolicyrequestpolicytype.mdx b/docs/components/moderationaccountguardrailpolicyrequestpolicytype.mdx new file mode 100644 index 000000000..c1095adc2 --- /dev/null +++ b/docs/components/moderationaccountguardrailpolicyrequestpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModerationAccountGuardrailPolicyRequestPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModerationAccountGuardrailPolicyRequestPolicyType +value: ModerationAccountGuardrailPolicyRequestPolicyType = "moderation" +``` + + +## Values + +- `"moderation"` diff --git a/docs/components/moderationguardrailpolicy.mdx b/docs/components/moderationguardrailpolicy.mdx new file mode 100644 index 000000000..9092f187c --- /dev/null +++ b/docs/components/moderationguardrailpolicy.mdx @@ -0,0 +1,12 @@ +--- +title: "ModerationGuardrailPolicy" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `config` | [components.GuardrailModerationPolicyConfig](../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.ModerationGuardrailPolicyPolicyType](../components/moderationguardrailpolicypolicytype.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/moderationguardrailpolicydetail.mdx b/docs/components/moderationguardrailpolicydetail.mdx new file mode 100644 index 000000000..162de7e17 --- /dev/null +++ b/docs/components/moderationguardrailpolicydetail.mdx @@ -0,0 +1,23 @@ +--- +title: "ModerationGuardrailPolicyDetail" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `api_key_hashes` | List[*str*] | ✔️ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailModerationPolicyConfig](../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_account_policy` | *Optional[bool]* | ➖ | Whether this is an account-owned policy rather than a workspace policy | | +| `is_workspace_default` | *Optional[bool]* | ➖ | N/A | | +| `member_ids` | List[*str*] | ✔️ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ✔️ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `overridden_api_key_hashes` | List[*str*] | ✔️ | API keys that have a different policy of this type assigned directly | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `overridden_member_ids` | List[*str*] | ➖ | Members that have a different policy of this type assigned directly | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `policy_type` | [components.ModerationGuardrailPolicyDetailPolicyType](../components/moderationguardrailpolicydetailpolicytype.mdx) | ✔️ | N/A | | +| `reference` | [OptionalNullable[components.ModerationGuardrailPolicyDetailReference]](../components/moderationguardrailpolicydetailreference.mdx) | ➖ | `legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null` | | +| `replaces_legacy_default` | *Optional[bool]* | ➖ | Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/moderationguardrailpolicydetailpolicytype.mdx b/docs/components/moderationguardrailpolicydetailpolicytype.mdx new file mode 100644 index 000000000..40d072cd0 --- /dev/null +++ b/docs/components/moderationguardrailpolicydetailpolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModerationGuardrailPolicyDetailPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModerationGuardrailPolicyDetailPolicyType +value: ModerationGuardrailPolicyDetailPolicyType = "moderation" +``` + + +## Values + +- `"moderation"` diff --git a/docs/components/moderationguardrailpolicydetailreference.mdx b/docs/components/moderationguardrailpolicydetailreference.mdx new file mode 100644 index 000000000..825956682 --- /dev/null +++ b/docs/components/moderationguardrailpolicydetailreference.mdx @@ -0,0 +1,22 @@ +--- +title: "ModerationGuardrailPolicyDetailReference" +--- + +`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null` + +## Example Usage + +```python +from openrouter.components import ModerationGuardrailPolicyDetailReference + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ModerationGuardrailPolicyDetailReference = "legacy_mapping" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"legacy_mapping"` +- `"account_default"` diff --git a/docs/components/moderationguardrailpolicydetailresponse.mdx b/docs/components/moderationguardrailpolicydetailresponse.mdx new file mode 100644 index 000000000..1e6bc9210 --- /dev/null +++ b/docs/components/moderationguardrailpolicydetailresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ModerationGuardrailPolicyDetailResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `data` | [components.ModerationGuardrailPolicyDetail](../components/moderationguardrailpolicydetail.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/moderationguardrailpolicypolicytype.mdx b/docs/components/moderationguardrailpolicypolicytype.mdx new file mode 100644 index 000000000..0092e28bf --- /dev/null +++ b/docs/components/moderationguardrailpolicypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModerationGuardrailPolicyPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModerationGuardrailPolicyPolicyType +value: ModerationGuardrailPolicyPolicyType = "moderation" +``` + + +## Values + +- `"moderation"` diff --git a/docs/components/moderationguardrailpolicyresponse.mdx b/docs/components/moderationguardrailpolicyresponse.mdx new file mode 100644 index 000000000..7912e09b6 --- /dev/null +++ b/docs/components/moderationguardrailpolicyresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ModerationGuardrailPolicyResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `data` | [components.ModerationGuardrailPolicy](../components/moderationguardrailpolicy.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/moderationguardrailpolicysummary.mdx b/docs/components/moderationguardrailpolicysummary.mdx new file mode 100644 index 000000000..8b93d17cd --- /dev/null +++ b/docs/components/moderationguardrailpolicysummary.mdx @@ -0,0 +1,19 @@ +--- +title: "ModerationGuardrailPolicySummary" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `api_key_count` | *int* | ✔️ | N/A | | +| `config` | [components.GuardrailModerationPolicyConfig](../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `is_legacy_mapped` | *Optional[bool]* | ➖ | Whether the policy is kept in sync with a v1 guardrail | | +| `is_workspace_default` | *Optional[bool]* | ➖ | N/A | | +| `legacy_guardrail_ids` | List[*str*] | ➖ | IDs of the v1 guardrails this policy was migrated from | | +| `member_count` | *int* | ✔️ | N/A | | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.ModerationGuardrailPolicySummaryPolicyType](../components/moderationguardrailpolicysummarypolicytype.mdx) | ✔️ | N/A | | +| `replaced_legacy_guardrail_ids` | List[*str*] | ➖ | IDs of the v1 guardrails this policy replaced | | +| `updated_at` | *Nullable[str]* | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/moderationguardrailpolicysummarypolicytype.mdx b/docs/components/moderationguardrailpolicysummarypolicytype.mdx new file mode 100644 index 000000000..deabfaa8c --- /dev/null +++ b/docs/components/moderationguardrailpolicysummarypolicytype.mdx @@ -0,0 +1,15 @@ +--- +title: "ModerationGuardrailPolicySummaryPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ModerationGuardrailPolicySummaryPolicyType +value: ModerationGuardrailPolicySummaryPolicyType = "moderation" +``` + + +## Values + +- `"moderation"` diff --git a/docs/components/outputmemoryservertoolitem.mdx b/docs/components/outputmemoryservertoolitem.mdx index fe6c3ecee..f22c53ef0 100644 --- a/docs/components/outputmemoryservertoolitem.mdx +++ b/docs/components/outputmemoryservertoolitem.mdx @@ -7,11 +7,11 @@ An openrouter:memory server tool output item ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `action` | [Optional[components.ActionEnum]](../components/actionenum.mdx) | ➖ | N/A | | -| `id` | *Optional[str]* | ➖ | N/A | | -| `key` | *Optional[str]* | ➖ | N/A | | -| `status` | [components.ToolCallStatus](../components/toolcallstatus.mdx) | ✔️ | N/A | completed | -| `type` | [components.OutputMemoryServerToolItemType](../components/outputmemoryservertoolitemtype.mdx) | ✔️ | N/A | | -| `value` | *Optional[Any]* | ➖ | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `action` | [Optional[components.OutputMemoryServerToolItemAction]](../components/outputmemoryservertoolitemaction.mdx) | ➖ | N/A | | +| `id` | *Optional[str]* | ➖ | N/A | | +| `key` | *Optional[str]* | ➖ | N/A | | +| `status` | [components.ToolCallStatus](../components/toolcallstatus.mdx) | ✔️ | N/A | completed | +| `type` | [components.OutputMemoryServerToolItemType](../components/outputmemoryservertoolitemtype.mdx) | ✔️ | N/A | | +| `value` | *Optional[Any]* | ➖ | N/A | | \ No newline at end of file diff --git a/docs/components/outputmemoryservertoolitemaction.mdx b/docs/components/outputmemoryservertoolitemaction.mdx new file mode 100644 index 000000000..e4686f6b5 --- /dev/null +++ b/docs/components/outputmemoryservertoolitemaction.mdx @@ -0,0 +1,21 @@ +--- +title: "OutputMemoryServerToolItemAction" +--- + +## Example Usage + +```python +from openrouter.components import OutputMemoryServerToolItemAction + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: OutputMemoryServerToolItemAction = "read" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"read"` +- `"write"` +- `"delete"` diff --git a/docs/components/piifilter.mdx b/docs/components/piifilter.mdx new file mode 100644 index 000000000..45d0708f8 --- /dev/null +++ b/docs/components/piifilter.mdx @@ -0,0 +1,11 @@ +--- +title: "PiiFilter" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `action` | [components.PiiFilterAction](../components/piifilteraction.mdx) | ✔️ | N/A | +| `entity_type` | *str* | ✔️ | N/A | +| `score_threshold` | *Optional[float]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/piifilteraction.mdx b/docs/components/piifilteraction.mdx new file mode 100644 index 000000000..6e7977acb --- /dev/null +++ b/docs/components/piifilteraction.mdx @@ -0,0 +1,21 @@ +--- +title: "PiiFilterAction" +--- + +## Example Usage + +```python +from openrouter.components import PiiFilterAction + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: PiiFilterAction = "redact" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"redact"` +- `"block"` +- `"flag"` diff --git a/docs/components/actionenum.mdx b/docs/components/scanscope.mdx similarity index 59% rename from docs/components/actionenum.mdx rename to docs/components/scanscope.mdx index 9bed0a582..7d0925fde 100644 --- a/docs/components/actionenum.mdx +++ b/docs/components/scanscope.mdx @@ -1,14 +1,14 @@ --- -title: "ActionEnum" +title: "ScanScope" --- ## Example Usage ```python -from openrouter.components import ActionEnum +from openrouter.components import ScanScope # Open enum: unrecognized values are captured as UnrecognizedStr -value: ActionEnum = "read" +value: ScanScope = "user_only" ``` @@ -16,6 +16,5 @@ value: ActionEnum = "read" This is an open enum. Unrecognized values will not fail type checks. -- `"read"` -- `"write"` -- `"delete"` +- `"user_only"` +- `"all_messages"` diff --git a/docs/components/slug.mdx b/docs/components/slug.mdx new file mode 100644 index 000000000..64c2b8bb8 --- /dev/null +++ b/docs/components/slug.mdx @@ -0,0 +1,27 @@ +--- +title: "Slug" +--- + +## Example Usage + +```python +from openrouter.components import Slug + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Slug = "email" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"email"` +- `"phone"` +- `"ssn"` +- `"credit-card"` +- `"ip-address"` +- `"secrets"` +- `"person-name"` +- `"address"` +- `"regex-prompt-injection"` diff --git a/docs/components/updatebudgetguardrailpolicyrequest.mdx b/docs/components/updatebudgetguardrailpolicyrequest.mdx new file mode 100644 index 000000000..9d0aae756 --- /dev/null +++ b/docs/components/updatebudgetguardrailpolicyrequest.mdx @@ -0,0 +1,16 @@ +--- +title: "UpdateBudgetGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `api_key_hashes` | List[*str*] | ➖ | Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailBudgetPolicyAuthoringConfig](../components/guardrailbudgetpolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `is_workspace_default` | *Optional[bool]* | ➖ | Omit to keep the stored default status; `false` unsets the policy as the workspace default. | | +| `member_ids` | List[*str*] | ➖ | Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/updatemodelavailabilityguardrailpolicyrequest.mdx b/docs/components/updatemodelavailabilityguardrailpolicyrequest.mdx new file mode 100644 index 000000000..46261200d --- /dev/null +++ b/docs/components/updatemodelavailabilityguardrailpolicyrequest.mdx @@ -0,0 +1,16 @@ +--- +title: "UpdateModelAvailabilityGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_key_hashes` | List[*str*] | ➖ | Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailModelAvailabilityPolicyAuthoringConfig](../components/guardrailmodelavailabilitypolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `is_workspace_default` | *Optional[bool]* | ➖ | Omit to keep the stored default status; `false` unsets the policy as the workspace default. | | +| `member_ids` | List[*str*] | ➖ | Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/updatemoderationguardrailpolicyrequest.mdx b/docs/components/updatemoderationguardrailpolicyrequest.mdx new file mode 100644 index 000000000..c39a57e70 --- /dev/null +++ b/docs/components/updatemoderationguardrailpolicyrequest.mdx @@ -0,0 +1,16 @@ +--- +title: "UpdateModerationGuardrailPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `api_key_hashes` | List[*str*] | ➖ | Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `config` | [components.GuardrailModerationPolicyConfig](../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `is_workspace_default` | *Optional[bool]* | ➖ | Omit to keep the stored default status; `false` unsets the policy as the workspace default. | | +| `member_ids` | List[*str*] | ➖ | Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/changeapikeypolicyassignmentglobals.mdx b/docs/operations/changeapikeypolicyassignmentglobals.mdx new file mode 100644 index 000000000..2a2df3b45 --- /dev/null +++ b/docs/operations/changeapikeypolicyassignmentglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ChangeAPIKeyPolicyAssignmentGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/changeapikeypolicyassignmentrequest.mdx b/docs/operations/changeapikeypolicyassignmentrequest.mdx new file mode 100644 index 000000000..61c6d6417 --- /dev/null +++ b/docs/operations/changeapikeypolicyassignmentrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "ChangeAPIKeyPolicyAssignmentRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `hash` | *str* | ✔️ | API key hash | c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 | +| `change_guardrail_policy_assignment_request` | [components.ChangeGuardrailPolicyAssignmentRequest](../components/changeguardrailpolicyassignmentrequest.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/operations/changememberpolicyassignmentglobals.mdx b/docs/operations/changememberpolicyassignmentglobals.mdx new file mode 100644 index 000000000..3a7aa244c --- /dev/null +++ b/docs/operations/changememberpolicyassignmentglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ChangeMemberPolicyAssignmentGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/changememberpolicyassignmentrequest.mdx b/docs/operations/changememberpolicyassignmentrequest.mdx new file mode 100644 index 000000000..8741e0dcc --- /dev/null +++ b/docs/operations/changememberpolicyassignmentrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "ChangeMemberPolicyAssignmentRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `member_id` | *str* | ✔️ | Organization member user ID | user_2abcDEFghiJKLmnoPQRstu | +| `change_guardrail_policy_assignment_request` | [components.ChangeGuardrailPolicyAssignmentRequest](../components/changeguardrailpolicyassignmentrequest.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/operations/createaccountpolicyglobals.mdx b/docs/operations/createaccountpolicyglobals.mdx new file mode 100644 index 000000000..85c4a2414 --- /dev/null +++ b/docs/operations/createaccountpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateAccountPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/createaccountpolicyrequest.mdx b/docs/operations/createaccountpolicyrequest.mdx new file mode 100644 index 000000000..ea541568f --- /dev/null +++ b/docs/operations/createaccountpolicyrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "CreateAccountPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `account_guardrail_policy_request` | [components.AccountGuardrailPolicyRequest](../components/accountguardrailpolicyrequest.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/createbudgetpolicyglobals.mdx b/docs/operations/createbudgetpolicyglobals.mdx new file mode 100644 index 000000000..e3cda40c1 --- /dev/null +++ b/docs/operations/createbudgetpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateBudgetPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/createbudgetpolicyrequest.mdx b/docs/operations/createbudgetpolicyrequest.mdx new file mode 100644 index 000000000..8a5cce6e1 --- /dev/null +++ b/docs/operations/createbudgetpolicyrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "CreateBudgetPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `create_budget_guardrail_policy_request` | [components.CreateBudgetGuardrailPolicyRequest](../components/createbudgetguardrailpolicyrequest.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/createmodelavailabilitypolicyglobals.mdx b/docs/operations/createmodelavailabilitypolicyglobals.mdx new file mode 100644 index 000000000..c15618021 --- /dev/null +++ b/docs/operations/createmodelavailabilitypolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateModelAvailabilityPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/createmodelavailabilitypolicyrequest.mdx b/docs/operations/createmodelavailabilitypolicyrequest.mdx new file mode 100644 index 000000000..db345f964 --- /dev/null +++ b/docs/operations/createmodelavailabilitypolicyrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "CreateModelAvailabilityPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `create_model_availability_guardrail_policy_request` | [components.CreateModelAvailabilityGuardrailPolicyRequest](../components/createmodelavailabilityguardrailpolicyrequest.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/createmoderationpolicyglobals.mdx b/docs/operations/createmoderationpolicyglobals.mdx new file mode 100644 index 000000000..234bae656 --- /dev/null +++ b/docs/operations/createmoderationpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateModerationPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/createmoderationpolicyrequest.mdx b/docs/operations/createmoderationpolicyrequest.mdx new file mode 100644 index 000000000..943b39040 --- /dev/null +++ b/docs/operations/createmoderationpolicyrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "CreateModerationPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `create_moderation_guardrail_policy_request` | [components.CreateModerationGuardrailPolicyRequest](../components/createmoderationguardrailpolicyrequest.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/deleteaccountpolicyglobals.mdx b/docs/operations/deleteaccountpolicyglobals.mdx new file mode 100644 index 000000000..ed5c2dad6 --- /dev/null +++ b/docs/operations/deleteaccountpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "DeleteAccountPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/deleteaccountpolicyrequest.mdx b/docs/operations/deleteaccountpolicyrequest.mdx new file mode 100644 index 000000000..d494df9bb --- /dev/null +++ b/docs/operations/deleteaccountpolicyrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "DeleteAccountPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | \ No newline at end of file diff --git a/docs/operations/deletebudgetpolicyglobals.mdx b/docs/operations/deletebudgetpolicyglobals.mdx new file mode 100644 index 000000000..113dc43f7 --- /dev/null +++ b/docs/operations/deletebudgetpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "DeleteBudgetPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/deletebudgetpolicyrequest.mdx b/docs/operations/deletebudgetpolicyrequest.mdx new file mode 100644 index 000000000..44e320de4 --- /dev/null +++ b/docs/operations/deletebudgetpolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "DeleteBudgetPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/deletemodelavailabilitypolicyglobals.mdx b/docs/operations/deletemodelavailabilitypolicyglobals.mdx new file mode 100644 index 000000000..dd70a9037 --- /dev/null +++ b/docs/operations/deletemodelavailabilitypolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "DeleteModelAvailabilityPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/deletemodelavailabilitypolicyrequest.mdx b/docs/operations/deletemodelavailabilitypolicyrequest.mdx new file mode 100644 index 000000000..a86e140f8 --- /dev/null +++ b/docs/operations/deletemodelavailabilitypolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "DeleteModelAvailabilityPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/deletemoderationpolicyglobals.mdx b/docs/operations/deletemoderationpolicyglobals.mdx new file mode 100644 index 000000000..ce3ac45b6 --- /dev/null +++ b/docs/operations/deletemoderationpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "DeleteModerationPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/deletemoderationpolicyrequest.mdx b/docs/operations/deletemoderationpolicyrequest.mdx new file mode 100644 index 000000000..8532fcc74 --- /dev/null +++ b/docs/operations/deletemoderationpolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "DeleteModerationPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/getapikeypolicyassignmentglobals.mdx b/docs/operations/getapikeypolicyassignmentglobals.mdx new file mode 100644 index 000000000..f121aa621 --- /dev/null +++ b/docs/operations/getapikeypolicyassignmentglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetAPIKeyPolicyAssignmentGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getapikeypolicyassignmentpolicytype.mdx b/docs/operations/getapikeypolicyassignmentpolicytype.mdx new file mode 100644 index 000000000..aefef6cbc --- /dev/null +++ b/docs/operations/getapikeypolicyassignmentpolicytype.mdx @@ -0,0 +1,24 @@ +--- +title: "GetAPIKeyPolicyAssignmentPolicyType" +--- + +Policy type the assignment is read or changed for + +## Example Usage + +```python +from openrouter.operations import GetAPIKeyPolicyAssignmentPolicyType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GetAPIKeyPolicyAssignmentPolicyType = "budget" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"budget"` +- `"model_availability"` +- `"moderation"` +- `"rate_limit"` diff --git a/docs/operations/getapikeypolicyassignmentrequest.mdx b/docs/operations/getapikeypolicyassignmentrequest.mdx new file mode 100644 index 000000000..7a431538d --- /dev/null +++ b/docs/operations/getapikeypolicyassignmentrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "GetAPIKeyPolicyAssignmentRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `hash` | *str* | ✔️ | API key hash | c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `policy_type` | [operations.GetAPIKeyPolicyAssignmentPolicyType](../operations/getapikeypolicyassignmentpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for | budget | \ No newline at end of file diff --git a/docs/operations/getbudgetpolicyglobals.mdx b/docs/operations/getbudgetpolicyglobals.mdx new file mode 100644 index 000000000..11aa46f63 --- /dev/null +++ b/docs/operations/getbudgetpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetBudgetPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getbudgetpolicyrequest.mdx b/docs/operations/getbudgetpolicyrequest.mdx new file mode 100644 index 000000000..53da1b872 --- /dev/null +++ b/docs/operations/getbudgetpolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "GetBudgetPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/getmemberpolicyassignmentglobals.mdx b/docs/operations/getmemberpolicyassignmentglobals.mdx new file mode 100644 index 000000000..bbd9115cd --- /dev/null +++ b/docs/operations/getmemberpolicyassignmentglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetMemberPolicyAssignmentGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getmemberpolicyassignmentpolicytype.mdx b/docs/operations/getmemberpolicyassignmentpolicytype.mdx new file mode 100644 index 000000000..8f1249a1c --- /dev/null +++ b/docs/operations/getmemberpolicyassignmentpolicytype.mdx @@ -0,0 +1,24 @@ +--- +title: "GetMemberPolicyAssignmentPolicyType" +--- + +Policy type the assignment is read or changed for + +## Example Usage + +```python +from openrouter.operations import GetMemberPolicyAssignmentPolicyType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GetMemberPolicyAssignmentPolicyType = "budget" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"budget"` +- `"model_availability"` +- `"moderation"` +- `"rate_limit"` diff --git a/docs/operations/getmemberpolicyassignmentrequest.mdx b/docs/operations/getmemberpolicyassignmentrequest.mdx new file mode 100644 index 000000000..dee837e8c --- /dev/null +++ b/docs/operations/getmemberpolicyassignmentrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "GetMemberPolicyAssignmentRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `member_id` | *str* | ✔️ | Organization member user ID | user_2abcDEFghiJKLmnoPQRstu | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `policy_type` | [operations.GetMemberPolicyAssignmentPolicyType](../operations/getmemberpolicyassignmentpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for | budget | \ No newline at end of file diff --git a/docs/operations/getmodelavailabilitypolicyglobals.mdx b/docs/operations/getmodelavailabilitypolicyglobals.mdx new file mode 100644 index 000000000..c7180967b --- /dev/null +++ b/docs/operations/getmodelavailabilitypolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetModelAvailabilityPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getmodelavailabilitypolicyrequest.mdx b/docs/operations/getmodelavailabilitypolicyrequest.mdx new file mode 100644 index 000000000..77afcf905 --- /dev/null +++ b/docs/operations/getmodelavailabilitypolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "GetModelAvailabilityPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/getmoderationpolicyglobals.mdx b/docs/operations/getmoderationpolicyglobals.mdx new file mode 100644 index 000000000..9ed605c3d --- /dev/null +++ b/docs/operations/getmoderationpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetModerationPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getmoderationpolicyrequest.mdx b/docs/operations/getmoderationpolicyrequest.mdx new file mode 100644 index 000000000..002e39ad6 --- /dev/null +++ b/docs/operations/getmoderationpolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "GetModerationPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/listaccountpoliciesglobals.mdx b/docs/operations/listaccountpoliciesglobals.mdx new file mode 100644 index 000000000..8f0ad2375 --- /dev/null +++ b/docs/operations/listaccountpoliciesglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListAccountPoliciesGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listaccountpoliciesrequest.mdx b/docs/operations/listaccountpoliciesrequest.mdx new file mode 100644 index 000000000..b559f12e7 --- /dev/null +++ b/docs/operations/listaccountpoliciesrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "ListAccountPoliciesRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | \ No newline at end of file diff --git a/docs/operations/listaccountpoliciesresponse.mdx b/docs/operations/listaccountpoliciesresponse.mdx new file mode 100644 index 000000000..259391ed6 --- /dev/null +++ b/docs/operations/listaccountpoliciesresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListAccountPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `result` | [components.ListAccountGuardrailPoliciesResponse](../components/listaccountguardrailpoliciesresponse.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/listbudgetpoliciesglobals.mdx b/docs/operations/listbudgetpoliciesglobals.mdx new file mode 100644 index 000000000..b63e94c1d --- /dev/null +++ b/docs/operations/listbudgetpoliciesglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListBudgetPoliciesGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listbudgetpoliciesrequest.mdx b/docs/operations/listbudgetpoliciesrequest.mdx new file mode 100644 index 000000000..27212a740 --- /dev/null +++ b/docs/operations/listbudgetpoliciesrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "ListBudgetPoliciesRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/listbudgetpoliciesresponse.mdx b/docs/operations/listbudgetpoliciesresponse.mdx new file mode 100644 index 000000000..2c5031e57 --- /dev/null +++ b/docs/operations/listbudgetpoliciesresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListBudgetPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `result` | [components.ListBudgetGuardrailPoliciesResponse](../components/listbudgetguardrailpoliciesresponse.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/listmodelavailabilitypoliciesglobals.mdx b/docs/operations/listmodelavailabilitypoliciesglobals.mdx new file mode 100644 index 000000000..f13ee104f --- /dev/null +++ b/docs/operations/listmodelavailabilitypoliciesglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListModelAvailabilityPoliciesGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listmodelavailabilitypoliciesrequest.mdx b/docs/operations/listmodelavailabilitypoliciesrequest.mdx new file mode 100644 index 000000000..7158e2ca1 --- /dev/null +++ b/docs/operations/listmodelavailabilitypoliciesrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "ListModelAvailabilityPoliciesRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/listmodelavailabilitypoliciesresponse.mdx b/docs/operations/listmodelavailabilitypoliciesresponse.mdx new file mode 100644 index 000000000..084096dba --- /dev/null +++ b/docs/operations/listmodelavailabilitypoliciesresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListModelAvailabilityPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ListModelAvailabilityGuardrailPoliciesResponse](../components/listmodelavailabilityguardrailpoliciesresponse.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/listmoderationpoliciesglobals.mdx b/docs/operations/listmoderationpoliciesglobals.mdx new file mode 100644 index 000000000..294535c44 --- /dev/null +++ b/docs/operations/listmoderationpoliciesglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListModerationPoliciesGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listmoderationpoliciesrequest.mdx b/docs/operations/listmoderationpoliciesrequest.mdx new file mode 100644 index 000000000..9de40c805 --- /dev/null +++ b/docs/operations/listmoderationpoliciesrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "ListModerationPoliciesRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/listmoderationpoliciesresponse.mdx b/docs/operations/listmoderationpoliciesresponse.mdx new file mode 100644 index 000000000..a1ff97761 --- /dev/null +++ b/docs/operations/listmoderationpoliciesresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListModerationPoliciesResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ListModerationGuardrailPoliciesResponse](../components/listmoderationguardrailpoliciesresponse.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/updateaccountpolicyglobals.mdx b/docs/operations/updateaccountpolicyglobals.mdx new file mode 100644 index 000000000..e308c5591 --- /dev/null +++ b/docs/operations/updateaccountpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "UpdateAccountPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/updateaccountpolicyrequest.mdx b/docs/operations/updateaccountpolicyrequest.mdx new file mode 100644 index 000000000..3b6e63857 --- /dev/null +++ b/docs/operations/updateaccountpolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "UpdateAccountPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `account_guardrail_policy_request` | [components.AccountGuardrailPolicyRequest](../components/accountguardrailpolicyrequest.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/operations/updatebudgetpolicyglobals.mdx b/docs/operations/updatebudgetpolicyglobals.mdx new file mode 100644 index 000000000..bcc2a3a92 --- /dev/null +++ b/docs/operations/updatebudgetpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "UpdateBudgetPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/updatebudgetpolicyrequest.mdx b/docs/operations/updatebudgetpolicyrequest.mdx new file mode 100644 index 000000000..79634dbcc --- /dev/null +++ b/docs/operations/updatebudgetpolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "UpdateBudgetPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `update_budget_guardrail_policy_request` | [components.UpdateBudgetGuardrailPolicyRequest](../components/updatebudgetguardrailpolicyrequest.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/operations/updatemodelavailabilitypolicyglobals.mdx b/docs/operations/updatemodelavailabilitypolicyglobals.mdx new file mode 100644 index 000000000..c7fd5068a --- /dev/null +++ b/docs/operations/updatemodelavailabilitypolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "UpdateModelAvailabilityPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/updatemodelavailabilitypolicyrequest.mdx b/docs/operations/updatemodelavailabilitypolicyrequest.mdx new file mode 100644 index 000000000..8b1ef9b4b --- /dev/null +++ b/docs/operations/updatemodelavailabilitypolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "UpdateModelAvailabilityPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `update_model_availability_guardrail_policy_request` | [components.UpdateModelAvailabilityGuardrailPolicyRequest](../components/updatemodelavailabilityguardrailpolicyrequest.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/operations/updatemoderationpolicyglobals.mdx b/docs/operations/updatemoderationpolicyglobals.mdx new file mode 100644 index 000000000..bb19d5d04 --- /dev/null +++ b/docs/operations/updatemoderationpolicyglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "UpdateModerationPolicyGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/updatemoderationpolicyrequest.mdx b/docs/operations/updatemoderationpolicyrequest.mdx new file mode 100644 index 000000000..83b9a8f6b --- /dev/null +++ b/docs/operations/updatemoderationpolicyrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "UpdateModerationPolicyRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `update_moderation_guardrail_policy_request` | [components.UpdateModerationGuardrailPolicyRequest](../components/updatemoderationguardrailpolicyrequest.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/sdks/guardrailpolicies/README.mdx b/docs/sdks/guardrailpolicies/README.mdx new file mode 100644 index 000000000..0fa8a42f9 --- /dev/null +++ b/docs/sdks/guardrailpolicies/README.mdx @@ -0,0 +1,1318 @@ +--- +title: "Guardrail Policies" +description: "Guardrail Policies endpoints" +--- + +## Overview + +Guardrail Policies endpoints + +### Available Operations + +* [list_account_policies](#list_account_policies) - List workspace-wide policies +* [create_account_policy](#create_account_policy) - Create a workspace-wide policy +* [delete_account_policy](#delete_account_policy) - Delete a workspace-wide policy +* [update_account_policy](#update_account_policy) - Update a workspace-wide policy +* [get_api_key_policy_assignment](#get_api_key_policy_assignment) - Get an API key policy assignment +* [change_api_key_policy_assignment](#change_api_key_policy_assignment) - Change an API key policy assignment +* [get_member_policy_assignment](#get_member_policy_assignment) - Get a member policy assignment +* [change_member_policy_assignment](#change_member_policy_assignment) - Change a member policy assignment +* [list_budget_policies](#list_budget_policies) - List budget policies +* [create_budget_policy](#create_budget_policy) - Create a budget policy +* [delete_budget_policy](#delete_budget_policy) - Delete a budget policy +* [get_budget_policy](#get_budget_policy) - Get a budget policy +* [update_budget_policy](#update_budget_policy) - Update a budget policy +* [list_model_availability_policies](#list_model_availability_policies) - List model availability policies +* [create_model_availability_policy](#create_model_availability_policy) - Create a model availability policy +* [delete_model_availability_policy](#delete_model_availability_policy) - Delete a model availability policy +* [get_model_availability_policy](#get_model_availability_policy) - Get a model availability policy +* [update_model_availability_policy](#update_model_availability_policy) - Update a model availability policy +* [list_moderation_policies](#list_moderation_policies) - List moderation policies +* [create_moderation_policy](#create_moderation_policy) - Create a moderation policy +* [delete_moderation_policy](#delete_moderation_policy) - Delete a moderation policy +* [get_moderation_policy](#get_moderation_policy) - Get a moderation policy +* [update_moderation_policy](#update_moderation_policy) - Update a moderation policy + +## list_account_policies + +List the workspace-wide policies that apply across workspaces in the account. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.list_account_policies() + + while res is not None: + # Handle items + + res = res.next() + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.ListAccountPoliciesResponse](../../operations/listaccountpoliciesresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## create_account_policy + +Create a workspace-wide budget, moderation, or model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.create_account_policy(account_guardrail_policy_request={ + "config": { + "include_byok_in_budgets": False, + "limit_usd": 200.0, + "reset_interval": "monthly", + }, + "name": "Engineering monthly budget", + "policy_type": "budget", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_guardrail_policy_request` | [components.AccountGuardrailPolicyRequest](../../components/accountguardrailpolicyrequest.mdx) | ✔️ | N/A | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.AccountGuardrailPolicyResponse](../../components/accountguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## delete_account_policy + +Delete a workspace-wide policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.delete_account_policy(id="550e8400-e29b-41d4-a716-446655440000") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.DeleteGuardrailPolicyResponse](../../components/deleteguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## update_account_policy + +Replace a workspace-wide policy and its workspace coverage. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.update_account_policy(id="550e8400-e29b-41d4-a716-446655440000", account_guardrail_policy_request={ + "config": { + "include_byok_in_budgets": False, + "limit_usd": 200.0, + "reset_interval": "monthly", + }, + "name": "Engineering monthly budget", + "policy_type": "budget", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `account_guardrail_policy_request` | [components.AccountGuardrailPolicyRequest](../../components/accountguardrailpolicyrequest.mdx) | ✔️ | N/A | | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.AccountGuardrailPolicyResponse](../../components/accountguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_api_key_policy_assignment + +Get the policies of one type that apply to an API key in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.get_api_key_policy_assignment(hash="c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11", policy_type="budget") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `hash` | *str* | ✔️ | API key hash | c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `policy_type` | [operations.GetAPIKeyPolicyAssignmentPolicyType](../../operations/getapikeypolicyassignmentpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for | budget | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.GuardrailPolicyAssignmentResponse](../../components/guardrailpolicyassignmentresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## change_api_key_policy_assignment + +Assign or unassign one policy for an API key. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.change_api_key_policy_assignment(hash="c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", assigned=True, expected_assignment={ + "opted_out": False, + "policy_ids": [], + "workspace_default_policy_ids": [ + "2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90", + ], + }, policy_id="550e8400-e29b-41d4-a716-446655440000", policy_type="budget", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `hash` | *str* | ✔️ | API key hash | c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 | +| `assigned` | *bool* | ✔️ | `true` assigns the policy to the subject, `false` removes it | true | +| `expected_assignment` | [components.GuardrailPolicyAssignmentState](../../components/guardrailpolicyassignmentstate.mdx) | ✔️ | N/A | | +| `policy_id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `policy_type` | [components.ChangeGuardrailPolicyAssignmentRequestPolicyType](../../components/changeguardrailpolicyassignmentrequestpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for | budget | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ChangeGuardrailPolicyAssignmentResponse](../../components/changeguardrailpolicyassignmentresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_member_policy_assignment + +Get the policies of one type that apply to a member in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.get_member_policy_assignment(member_id="user_2abcDEFghiJKLmnoPQRstu", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11", policy_type="budget") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `member_id` | *str* | ✔️ | Organization member user ID | user_2abcDEFghiJKLmnoPQRstu | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `policy_type` | [operations.GetMemberPolicyAssignmentPolicyType](../../operations/getmemberpolicyassignmentpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for | budget | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.GuardrailPolicyAssignmentResponse](../../components/guardrailpolicyassignmentresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## change_member_policy_assignment + +Assign or unassign one policy for a member. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.change_member_policy_assignment(member_id="user_2abcDEFghiJKLmnoPQRstu", assigned=True, expected_assignment={ + "opted_out": False, + "policy_ids": [], + "workspace_default_policy_ids": [ + "2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90", + ], + }, policy_id="550e8400-e29b-41d4-a716-446655440000", policy_type="budget", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `member_id` | *str* | ✔️ | Organization member user ID | user_2abcDEFghiJKLmnoPQRstu | +| `assigned` | *bool* | ✔️ | `true` assigns the policy to the subject, `false` removes it | true | +| `expected_assignment` | [components.GuardrailPolicyAssignmentState](../../components/guardrailpolicyassignmentstate.mdx) | ✔️ | N/A | | +| `policy_id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `policy_type` | [components.ChangeGuardrailPolicyAssignmentRequestPolicyType](../../components/changeguardrailpolicyassignmentrequestpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for | budget | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ChangeGuardrailPolicyAssignmentResponse](../../components/changeguardrailpolicyassignmentresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_budget_policies + +List the budget policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.list_budget_policies(workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + while res is not None: + # Handle items + + res = res.next() + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.ListBudgetPoliciesResponse](../../operations/listbudgetpoliciesresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## create_budget_policy + +Create a budget policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.create_budget_policy(config={ + "include_byok_in_budgets": False, + "limit_usd": 200.0, + "reset_interval": "monthly", + }, name="Engineering monthly budget", policy_type="budget", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailBudgetPolicyAuthoringConfig](../../components/guardrailbudgetpolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.CreateBudgetGuardrailPolicyRequestPolicyType](../../components/createbudgetguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `is_workspace_default` | *Optional[bool]* | ➖ | Make this the workspace default for its policy type. Defaults to `false`. | | +| `member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API keys that should not inherit the policy when it is the workspace default | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Members that should not inherit the policy when it is the workspace default | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.BudgetGuardrailPolicyResponse](../../components/budgetguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## delete_budget_policy + +Delete a budget policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.delete_budget_policy(id="550e8400-e29b-41d4-a716-446655440000", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.DeleteGuardrailPolicyResponse](../../components/deleteguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_budget_policy + +Get a budget policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.get_budget_policy(id="550e8400-e29b-41d4-a716-446655440000", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.BudgetGuardrailPolicyDetailResponse](../../components/budgetguardrailpolicydetailresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## update_budget_policy + +Replace a budget policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.update_budget_policy(id="550e8400-e29b-41d4-a716-446655440000", config={ + "include_byok_in_budgets": False, + "limit_usd": 200.0, + "reset_interval": "monthly", + }, name="Engineering monthly budget", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `config` | [components.GuardrailBudgetPolicyAuthoringConfig](../../components/guardrailbudgetpolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"include_byok_in_budgets": false,
"limit_usd": 200,
"reset_interval": "monthly"
} | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `api_key_hashes` | List[*str*] | ➖ | Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `is_workspace_default` | *Optional[bool]* | ➖ | Omit to keep the stored default status; `false` unsets the policy as the workspace default. | | +| `member_ids` | List[*str*] | ➖ | Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.BudgetGuardrailPolicyResponse](../../components/budgetguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_model_availability_policies + +List the model availability policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.list_model_availability_policies(workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + while res is not None: + # Handle items + + res = res.next() + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.ListModelAvailabilityPoliciesResponse](../../operations/listmodelavailabilitypoliciesresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## create_model_availability_policy + +Create a model availability policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.create_model_availability_policy(config={}, name="Engineering monthly budget", policy_type="model_availability", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailModelAvailabilityPolicyAuthoringConfig](../../components/guardrailmodelavailabilitypolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.CreateModelAvailabilityGuardrailPolicyRequestPolicyType](../../components/createmodelavailabilityguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `is_workspace_default` | *Optional[bool]* | ➖ | Make this the workspace default for its policy type. Defaults to `false`. | | +| `member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API keys that should not inherit the policy when it is the workspace default | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Members that should not inherit the policy when it is the workspace default | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ModelAvailabilityGuardrailPolicyResponse](../../components/modelavailabilityguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## delete_model_availability_policy + +Delete a model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.delete_model_availability_policy(id="550e8400-e29b-41d4-a716-446655440000", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.DeleteGuardrailPolicyResponse](../../components/deleteguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_model_availability_policy + +Get a model availability policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.get_model_availability_policy(id="550e8400-e29b-41d4-a716-446655440000", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ModelAvailabilityGuardrailPolicyDetailResponse](../../components/modelavailabilityguardrailpolicydetailresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## update_model_availability_policy + +Replace a model availability policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.update_model_availability_policy(id="550e8400-e29b-41d4-a716-446655440000", config={}, name="Engineering monthly budget", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `config` | [components.GuardrailModelAvailabilityPolicyAuthoringConfig](../../components/guardrailmodelavailabilitypolicyauthoringconfig.mdx) | ✔️ | N/A | \{
"allowed_models": [
"openai/gpt-4o",
"anthropic/claude-sonnet-4"
],
"allowed_providers": [
"openai",
"anthropic"
],
"enforce_zdr_anthropic": true,
"enforce_zdr_openai": true
} | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `api_key_hashes` | List[*str*] | ➖ | Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `is_workspace_default` | *Optional[bool]* | ➖ | Omit to keep the stored default status; `false` unsets the policy as the workspace default. | | +| `member_ids` | List[*str*] | ➖ | Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ModelAvailabilityGuardrailPolicyResponse](../../components/modelavailabilityguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_moderation_policies + +List the moderation policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.list_moderation_policies(workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + while res is not None: + # Handle items + + res = res.next() + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *Optional[int]* | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.ListModerationPoliciesResponse](../../operations/listmoderationpoliciesresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## create_moderation_policy + +Create a moderation policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter, components +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.create_moderation_policy(config=components.GuardrailModerationPolicyConfig(), name="Engineering monthly budget", policy_type="moderation", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [components.GuardrailModerationPolicyConfig](../../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `policy_type` | [components.CreateModerationGuardrailPolicyRequestPolicyType](../../components/createmoderationguardrailpolicyrequestpolicytype.mdx) | ✔️ | N/A | | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `is_workspace_default` | *Optional[bool]* | ➖ | Make this the workspace default for its policy type. Defaults to `false`. | | +| `member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API keys that should not inherit the policy when it is the workspace default | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Members that should not inherit the policy when it is the workspace default | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ModerationGuardrailPolicyResponse](../../components/moderationguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## delete_moderation_policy + +Delete a moderation policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.delete_moderation_policy(id="550e8400-e29b-41d4-a716-446655440000", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.DeleteGuardrailPolicyResponse](../../components/deleteguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_moderation_policy + +Get a moderation policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.get_moderation_policy(id="550e8400-e29b-41d4-a716-446655440000", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ModerationGuardrailPolicyDetailResponse](../../components/moderationguardrailpolicydetailresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## update_moderation_policy + +Replace a moderation policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter, components +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.update_moderation_policy(id="550e8400-e29b-41d4-a716-446655440000", config=components.GuardrailModerationPolicyConfig(), name="Engineering monthly budget", workspace_id="0df9e665-d932-5740-b2c7-b52af166bc11") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 | +| `config` | [components.GuardrailModerationPolicyConfig](../../components/guardrailmoderationpolicyconfig.mdx) | ✔️ | N/A | \{
"content_filter_builtins": [
\{
"action": "block",
"slug": "secrets"
}
]
} | +| `name` | *str* | ✔️ | Policy name | Engineering monthly budget | +| `workspace_id` | *str* | ✔️ | Workspace the policy belongs to | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `api_key_hashes` | List[*str*] | ➖ | Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `is_workspace_default` | *Optional[bool]* | ➖ | Omit to keep the stored default status; `false` unsets the policy as the workspace default. | | +| `member_ids` | List[*str*] | ➖ | Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `opted_out_api_key_hashes` | List[*str*] | ➖ | API key hashes | [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
] | +| `opted_out_member_ids` | List[*str*] | ➖ | Organization member user IDs | [
"user_2abcDEFghiJKLmnoPQRstu"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ModerationGuardrailPolicyResponse](../../components/moderationguardrailpolicyresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 326597ffe..8e0cd00d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.132" +version = "1.3.133" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 4c8151ae0..dbc071867 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.132" +__version__: str = "1.3.133" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.132 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.133 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 8cc06bc4a..e02bf331a 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -6,6 +6,19 @@ if TYPE_CHECKING: from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict + from .accountguardrailpolicy import ( + AccountGuardrailPolicy, + AccountGuardrailPolicyTypedDict, + UnknownAccountGuardrailPolicy, + ) + from .accountguardrailpolicyrequest import ( + AccountGuardrailPolicyRequest, + AccountGuardrailPolicyRequestTypedDict, + ) + from .accountguardrailpolicyresponse import ( + AccountGuardrailPolicyResponse, + AccountGuardrailPolicyResponseTypedDict, + ) from .activityitem import ActivityItem, ActivityItemTypedDict from .activityresponse import ActivityResponse, ActivityResponseTypedDict from .additionaltoolsitem import ( @@ -707,8 +720,8 @@ ArmorPlugin, ArmorPluginID, ArmorPluginMode, + ArmorPluginOnError, ArmorPluginTypedDict, - OnError, OutputMode, ) from .armorrule import ArmorRule, ArmorRuleTypedDict @@ -990,6 +1003,42 @@ BooleanCapabilityType, BooleanCapabilityTypedDict, ) + from .budgetaccountguardrailpolicy import ( + BudgetAccountGuardrailPolicy, + BudgetAccountGuardrailPolicyPolicyType, + BudgetAccountGuardrailPolicyTypedDict, + ) + from .budgetaccountguardrailpolicyrequest import ( + BudgetAccountGuardrailPolicyRequest, + BudgetAccountGuardrailPolicyRequestFloorReassignment, + BudgetAccountGuardrailPolicyRequestFloorReassignmentTypedDict, + BudgetAccountGuardrailPolicyRequestPolicyType, + BudgetAccountGuardrailPolicyRequestTypedDict, + ) + from .budgetguardrailpolicy import ( + BudgetGuardrailPolicy, + BudgetGuardrailPolicyPolicyType, + BudgetGuardrailPolicyTypedDict, + ) + from .budgetguardrailpolicydetail import ( + BudgetGuardrailPolicyDetail, + BudgetGuardrailPolicyDetailPolicyType, + BudgetGuardrailPolicyDetailReference, + BudgetGuardrailPolicyDetailTypedDict, + ) + from .budgetguardrailpolicydetailresponse import ( + BudgetGuardrailPolicyDetailResponse, + BudgetGuardrailPolicyDetailResponseTypedDict, + ) + from .budgetguardrailpolicyresponse import ( + BudgetGuardrailPolicyResponse, + BudgetGuardrailPolicyResponseTypedDict, + ) + from .budgetguardrailpolicysummary import ( + BudgetGuardrailPolicySummary, + BudgetGuardrailPolicySummaryPolicyType, + BudgetGuardrailPolicySummaryTypedDict, + ) from .bulkaddworkspacemembersrequest import ( BulkAddWorkspaceMembersRequest, BulkAddWorkspaceMembersRequestTypedDict, @@ -1045,6 +1094,15 @@ CapabilityDescriptorTypedDict, UnknownCapabilityDescriptor, ) + from .changeguardrailpolicyassignmentrequest import ( + ChangeGuardrailPolicyAssignmentRequest, + ChangeGuardrailPolicyAssignmentRequestPolicyType, + ChangeGuardrailPolicyAssignmentRequestTypedDict, + ) + from .changeguardrailpolicyassignmentresponse import ( + ChangeGuardrailPolicyAssignmentResponse, + ChangeGuardrailPolicyAssignmentResponseTypedDict, + ) from .chatassistantimages import ( ChatAssistantImages, ChatAssistantImagesImageURL, @@ -1496,6 +1554,11 @@ ContextCompressionPluginTypedDict, ) from .costdetails import CostDetails, CostDetailsTypedDict + from .createbudgetguardrailpolicyrequest import ( + CreateBudgetGuardrailPolicyRequest, + CreateBudgetGuardrailPolicyRequestPolicyType, + CreateBudgetGuardrailPolicyRequestTypedDict, + ) from .createbyokkeyrequest import ( CreateBYOKKeyRequest, CreateBYOKKeyRequestDeclaredRegion, @@ -1517,6 +1580,16 @@ CreateGuardrailResponse, CreateGuardrailResponseTypedDict, ) + from .createmodelavailabilityguardrailpolicyrequest import ( + CreateModelAvailabilityGuardrailPolicyRequest, + CreateModelAvailabilityGuardrailPolicyRequestPolicyType, + CreateModelAvailabilityGuardrailPolicyRequestTypedDict, + ) + from .createmoderationguardrailpolicyrequest import ( + CreateModerationGuardrailPolicyRequest, + CreateModerationGuardrailPolicyRequestPolicyType, + CreateModerationGuardrailPolicyRequestTypedDict, + ) from .createobservabilitydestinationrequest import ( CreateObservabilityDestinationRequest, CreateObservabilityDestinationRequestType, @@ -1767,6 +1840,10 @@ DeleteBYOKKeyResponse, DeleteBYOKKeyResponseTypedDict, ) + from .deleteguardrailpolicyresponse import ( + DeleteGuardrailPolicyResponse, + DeleteGuardrailPolicyResponseTypedDict, + ) from .deleteguardrailresponse import ( DeleteGuardrailResponse, DeleteGuardrailResponseTypedDict, @@ -2289,8 +2366,55 @@ GoneResponseErrorDataTypedDict, ) from .guardrail import Guardrail, GuardrailTypedDict + from .guardrailbudgetpolicyauthoringconfig import ( + GuardrailBudgetPolicyAuthoringConfig, + GuardrailBudgetPolicyAuthoringConfigResetInterval, + GuardrailBudgetPolicyAuthoringConfigTypedDict, + ) + from .guardrailbudgetpolicyconfig import ( + GuardrailBudgetPolicyConfig, + GuardrailBudgetPolicyConfigTypedDict, + ) from .guardraildataregion import GuardrailDataRegion from .guardrailinterval import GuardrailInterval + from .guardrailmodelavailabilitypolicyauthoringconfig import ( + GuardrailModelAvailabilityPolicyAuthoringConfig, + GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, + ) + from .guardrailmodelavailabilitypolicyconfig import ( + GuardrailModelAvailabilityPolicyConfig, + GuardrailModelAvailabilityPolicyConfigTypedDict, + ) + from .guardrailmoderationpolicyconfig import ( + Armor, + ArmorTypedDict, + ContentFilter, + ContentFilterBuiltin, + ContentFilterBuiltinTypedDict, + ContentFilterTypedDict, + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigContentFilterAction, + GuardrailModerationPolicyConfigContentFilterBuiltinAction, + GuardrailModerationPolicyConfigMode, + GuardrailModerationPolicyConfigOnError, + GuardrailModerationPolicyConfigTypedDict, + LakeraInjectionProtectionMode, + ModelArmorInjectionConfidenceLevel, + ModelArmorInjectionProtectionMode, + PiiFilter, + PiiFilterAction, + PiiFilterTypedDict, + ScanScope, + Slug, + ) + from .guardrailpolicyassignmentresponse import ( + GuardrailPolicyAssignmentResponse, + GuardrailPolicyAssignmentResponseTypedDict, + ) + from .guardrailpolicyassignmentstate import ( + GuardrailPolicyAssignmentState, + GuardrailPolicyAssignmentStateTypedDict, + ) from .imageconfig import ImageConfig, ImageConfigTypedDict from .imageendpoint import ImageEndpoint, ImageEndpointTypedDict from .imagegencallcompletedevent import ( @@ -2548,6 +2672,14 @@ LegacyWebSearchServerToolType, LegacyWebSearchServerToolTypedDict, ) + from .listaccountguardrailpoliciesresponse import ( + ListAccountGuardrailPoliciesResponse, + ListAccountGuardrailPoliciesResponseTypedDict, + ) + from .listbudgetguardrailpoliciesresponse import ( + ListBudgetGuardrailPoliciesResponse, + ListBudgetGuardrailPoliciesResponseTypedDict, + ) from .listbyokkeysresponse import ( ListBYOKKeysResponse, ListBYOKKeysResponseTypedDict, @@ -2574,6 +2706,14 @@ ListMemberAssignmentsResponse, ListMemberAssignmentsResponseTypedDict, ) + from .listmodelavailabilityguardrailpoliciesresponse import ( + ListModelAvailabilityGuardrailPoliciesResponse, + ListModelAvailabilityGuardrailPoliciesResponseTypedDict, + ) + from .listmoderationguardrailpoliciesresponse import ( + ListModerationGuardrailPoliciesResponse, + ListModerationGuardrailPoliciesResponseTypedDict, + ) from .listobservabilitydestinationsresponse import ( ListObservabilityDestinationsResponse, ListObservabilityDestinationsResponseTypedDict, @@ -2969,6 +3109,42 @@ from .model import Model, ModelTypedDict from .modelaliastarget import ModelAliasTarget, ModelAliasTargetTypedDict from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict + from .modelavailabilityaccountguardrailpolicy import ( + ModelAvailabilityAccountGuardrailPolicy, + ModelAvailabilityAccountGuardrailPolicyPolicyType, + ModelAvailabilityAccountGuardrailPolicyTypedDict, + ) + from .modelavailabilityaccountguardrailpolicyrequest import ( + ModelAvailabilityAccountGuardrailPolicyRequest, + ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignment, + ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignmentTypedDict, + ModelAvailabilityAccountGuardrailPolicyRequestPolicyType, + ModelAvailabilityAccountGuardrailPolicyRequestTypedDict, + ) + from .modelavailabilityguardrailpolicy import ( + ModelAvailabilityGuardrailPolicy, + ModelAvailabilityGuardrailPolicyPolicyType, + ModelAvailabilityGuardrailPolicyTypedDict, + ) + from .modelavailabilityguardrailpolicydetail import ( + ModelAvailabilityGuardrailPolicyDetail, + ModelAvailabilityGuardrailPolicyDetailPolicyType, + ModelAvailabilityGuardrailPolicyDetailReference, + ModelAvailabilityGuardrailPolicyDetailTypedDict, + ) + from .modelavailabilityguardrailpolicydetailresponse import ( + ModelAvailabilityGuardrailPolicyDetailResponse, + ModelAvailabilityGuardrailPolicyDetailResponseTypedDict, + ) + from .modelavailabilityguardrailpolicyresponse import ( + ModelAvailabilityGuardrailPolicyResponse, + ModelAvailabilityGuardrailPolicyResponseTypedDict, + ) + from .modelavailabilityguardrailpolicysummary import ( + ModelAvailabilityGuardrailPolicySummary, + ModelAvailabilityGuardrailPolicySummaryPolicyType, + ModelAvailabilityGuardrailPolicySummaryTypedDict, + ) from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modelgroup import ModelGroup from .modellinks import ModelLinks, ModelLinksTypedDict @@ -2986,6 +3162,42 @@ ModelsListResponseLinksTypedDict, ModelsListResponseTypedDict, ) + from .moderationaccountguardrailpolicy import ( + ModerationAccountGuardrailPolicy, + ModerationAccountGuardrailPolicyPolicyType, + ModerationAccountGuardrailPolicyTypedDict, + ) + from .moderationaccountguardrailpolicyrequest import ( + ModerationAccountGuardrailPolicyRequest, + ModerationAccountGuardrailPolicyRequestFloorReassignment, + ModerationAccountGuardrailPolicyRequestFloorReassignmentTypedDict, + ModerationAccountGuardrailPolicyRequestPolicyType, + ModerationAccountGuardrailPolicyRequestTypedDict, + ) + from .moderationguardrailpolicy import ( + ModerationGuardrailPolicy, + ModerationGuardrailPolicyPolicyType, + ModerationGuardrailPolicyTypedDict, + ) + from .moderationguardrailpolicydetail import ( + ModerationGuardrailPolicyDetail, + ModerationGuardrailPolicyDetailPolicyType, + ModerationGuardrailPolicyDetailReference, + ModerationGuardrailPolicyDetailTypedDict, + ) + from .moderationguardrailpolicydetailresponse import ( + ModerationGuardrailPolicyDetailResponse, + ModerationGuardrailPolicyDetailResponseTypedDict, + ) + from .moderationguardrailpolicyresponse import ( + ModerationGuardrailPolicyResponse, + ModerationGuardrailPolicyResponseTypedDict, + ) + from .moderationguardrailpolicysummary import ( + ModerationGuardrailPolicySummary, + ModerationGuardrailPolicySummaryPolicyType, + ModerationGuardrailPolicySummaryTypedDict, + ) from .moderationplugin import ( ModerationPlugin, ModerationPluginID, @@ -3609,8 +3821,8 @@ UnknownOutputItemWebSearchCallActionUnion, ) from .outputmemoryservertoolitem import ( - ActionEnum, OutputMemoryServerToolItem, + OutputMemoryServerToolItemAction, OutputMemoryServerToolItemType, OutputMemoryServerToolItemTypedDict, ) @@ -4545,6 +4757,10 @@ UnprocessableEntityResponseErrorData, UnprocessableEntityResponseErrorDataTypedDict, ) + from .updatebudgetguardrailpolicyrequest import ( + UpdateBudgetGuardrailPolicyRequest, + UpdateBudgetGuardrailPolicyRequestTypedDict, + ) from .updatebyokkeyrequest import ( UpdateBYOKKeyRequest, UpdateBYOKKeyRequestDeclaredRegion, @@ -4566,6 +4782,14 @@ UpdateGuardrailResponse, UpdateGuardrailResponseTypedDict, ) + from .updatemodelavailabilityguardrailpolicyrequest import ( + UpdateModelAvailabilityGuardrailPolicyRequest, + UpdateModelAvailabilityGuardrailPolicyRequestTypedDict, + ) + from .updatemoderationguardrailpolicyrequest import ( + UpdateModerationGuardrailPolicyRequest, + UpdateModerationGuardrailPolicyRequestTypedDict, + ) from .updateobservabilitydestinationrequest import ( UpdateObservabilityDestinationRequest, UpdateObservabilityDestinationRequestTypedDict, @@ -4842,10 +5066,15 @@ "APIErrorType", "APIType", "Account", + "AccountGuardrailPolicy", + "AccountGuardrailPolicyRequest", + "AccountGuardrailPolicyRequestTypedDict", + "AccountGuardrailPolicyResponse", + "AccountGuardrailPolicyResponseTypedDict", + "AccountGuardrailPolicyTypedDict", "AccountScope", "AccountType", "AccountTypedDict", - "ActionEnum", "ActivityItem", "ActivityItemTypedDict", "ActivityResponse", @@ -5300,6 +5529,7 @@ "ApplyPatchUpdateFileOperationTypedDict", "Architecture", "ArchitectureTypedDict", + "Armor", "ArmorAutoMode", "ArmorAutoModeTypedDict", "ArmorContext", @@ -5309,6 +5539,7 @@ "ArmorPlugin", "ArmorPluginID", "ArmorPluginMode", + "ArmorPluginOnError", "ArmorPluginTypedDict", "ArmorRule", "ArmorRuleTypedDict", @@ -5317,6 +5548,7 @@ "ArmorSafeguardResultStatus", "ArmorSafeguardResultStatusTypedDict", "ArmorSafeguardResultTypedDict", + "ArmorTypedDict", "AudioURL", "AudioURLTypedDict", "AuthMode", @@ -5487,6 +5719,28 @@ "BooleanCapabilityTypedDict", "Box", "BoxTypedDict", + "BudgetAccountGuardrailPolicy", + "BudgetAccountGuardrailPolicyPolicyType", + "BudgetAccountGuardrailPolicyRequest", + "BudgetAccountGuardrailPolicyRequestFloorReassignment", + "BudgetAccountGuardrailPolicyRequestFloorReassignmentTypedDict", + "BudgetAccountGuardrailPolicyRequestPolicyType", + "BudgetAccountGuardrailPolicyRequestTypedDict", + "BudgetAccountGuardrailPolicyTypedDict", + "BudgetGuardrailPolicy", + "BudgetGuardrailPolicyDetail", + "BudgetGuardrailPolicyDetailPolicyType", + "BudgetGuardrailPolicyDetailReference", + "BudgetGuardrailPolicyDetailResponse", + "BudgetGuardrailPolicyDetailResponseTypedDict", + "BudgetGuardrailPolicyDetailTypedDict", + "BudgetGuardrailPolicyPolicyType", + "BudgetGuardrailPolicyResponse", + "BudgetGuardrailPolicyResponseTypedDict", + "BudgetGuardrailPolicySummary", + "BudgetGuardrailPolicySummaryPolicyType", + "BudgetGuardrailPolicySummaryTypedDict", + "BudgetGuardrailPolicyTypedDict", "BulkAddWorkspaceMembersRequest", "BulkAddWorkspaceMembersRequestTypedDict", "BulkAddWorkspaceMembersResponse", @@ -5514,6 +5768,11 @@ "By", "CapabilityDescriptor", "CapabilityDescriptorTypedDict", + "ChangeGuardrailPolicyAssignmentRequest", + "ChangeGuardrailPolicyAssignmentRequestPolicyType", + "ChangeGuardrailPolicyAssignmentRequestTypedDict", + "ChangeGuardrailPolicyAssignmentResponse", + "ChangeGuardrailPolicyAssignmentResponseTypedDict", "ChatAssistantImages", "ChatAssistantImagesImageURL", "ChatAssistantImagesImageURLTypedDict", @@ -5784,15 +6043,19 @@ "ContentCompactionTypedDict", "ContentEncryptedContent", "ContentEncryptedContentTypedDict", + "ContentFilter", "ContentFilterAction", + "ContentFilterBuiltin", "ContentFilterBuiltinAction", "ContentFilterBuiltinEntry", "ContentFilterBuiltinEntryInput", "ContentFilterBuiltinEntryInputTypedDict", "ContentFilterBuiltinEntryTypedDict", "ContentFilterBuiltinSlug", + "ContentFilterBuiltinTypedDict", "ContentFilterEntry", "ContentFilterEntryTypedDict", + "ContentFilterTypedDict", "ContentImageURL", "ContentImageURLImageURL", "ContentImageURLImageURLTypedDict", @@ -5867,12 +6130,21 @@ "CreateBYOKKeyRequestTypedDict", "CreateBYOKKeyResponse", "CreateBYOKKeyResponseTypedDict", + "CreateBudgetGuardrailPolicyRequest", + "CreateBudgetGuardrailPolicyRequestPolicyType", + "CreateBudgetGuardrailPolicyRequestTypedDict", "CreateExternalUserRequest", "CreateExternalUserRequestTypedDict", "CreateGuardrailRequest", "CreateGuardrailRequestTypedDict", "CreateGuardrailResponse", "CreateGuardrailResponseTypedDict", + "CreateModelAvailabilityGuardrailPolicyRequest", + "CreateModelAvailabilityGuardrailPolicyRequestPolicyType", + "CreateModelAvailabilityGuardrailPolicyRequestTypedDict", + "CreateModerationGuardrailPolicyRequest", + "CreateModerationGuardrailPolicyRequestPolicyType", + "CreateModerationGuardrailPolicyRequestTypedDict", "CreateObservabilityDestinationRequest", "CreateObservabilityDestinationRequestType", "CreateObservabilityDestinationRequestTypedDict", @@ -6028,6 +6300,8 @@ "DeferredToolsSearchStrategyTypedDict", "DeleteBYOKKeyResponse", "DeleteBYOKKeyResponseTypedDict", + "DeleteGuardrailPolicyResponse", + "DeleteGuardrailPolicyResponseTypedDict", "DeleteGuardrailResponse", "DeleteGuardrailResponseTypedDict", "DeleteObservabilityDestinationResponse", @@ -6436,8 +6710,27 @@ "GoogleTypedDict", "GrantType", "Guardrail", + "GuardrailBudgetPolicyAuthoringConfig", + "GuardrailBudgetPolicyAuthoringConfigResetInterval", + "GuardrailBudgetPolicyAuthoringConfigTypedDict", + "GuardrailBudgetPolicyConfig", + "GuardrailBudgetPolicyConfigTypedDict", "GuardrailDataRegion", "GuardrailInterval", + "GuardrailModelAvailabilityPolicyAuthoringConfig", + "GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict", + "GuardrailModelAvailabilityPolicyConfig", + "GuardrailModelAvailabilityPolicyConfigTypedDict", + "GuardrailModerationPolicyConfig", + "GuardrailModerationPolicyConfigContentFilterAction", + "GuardrailModerationPolicyConfigContentFilterBuiltinAction", + "GuardrailModerationPolicyConfigMode", + "GuardrailModerationPolicyConfigOnError", + "GuardrailModerationPolicyConfigTypedDict", + "GuardrailPolicyAssignmentResponse", + "GuardrailPolicyAssignmentResponseTypedDict", + "GuardrailPolicyAssignmentState", + "GuardrailPolicyAssignmentStateTypedDict", "GuardrailTypedDict", "HardDeny", "HardDenyTypedDict", @@ -6651,6 +6944,7 @@ "KeyBudgetTypedDict", "KeyTypedDict", "Kty", + "LakeraInjectionProtectionMode", "LegacyChatContentVideo", "LegacyChatContentVideoInput", "LegacyChatContentVideoInputProcessing", @@ -6662,8 +6956,12 @@ "LegacyWebSearchServerToolTypedDict", "Legend", "LegendTypedDict", + "ListAccountGuardrailPoliciesResponse", + "ListAccountGuardrailPoliciesResponseTypedDict", "ListBYOKKeysResponse", "ListBYOKKeysResponseTypedDict", + "ListBudgetGuardrailPoliciesResponse", + "ListBudgetGuardrailPoliciesResponseTypedDict", "ListEndpointsResponse", "ListEndpointsResponseTypedDict", "ListExternalUsersResponse", @@ -6674,6 +6972,10 @@ "ListKeyAssignmentsResponseTypedDict", "ListMemberAssignmentsResponse", "ListMemberAssignmentsResponseTypedDict", + "ListModelAvailabilityGuardrailPoliciesResponse", + "ListModelAvailabilityGuardrailPoliciesResponseTypedDict", + "ListModerationGuardrailPoliciesResponse", + "ListModerationGuardrailPoliciesResponseTypedDict", "ListObservabilityDestinationsResponse", "ListObservabilityDestinationsResponseTypedDict", "ListPresetVersionsResponse", @@ -6918,6 +7220,30 @@ "ModelAliasTargetTypedDict", "ModelArchitecture", "ModelArchitectureTypedDict", + "ModelArmorInjectionConfidenceLevel", + "ModelArmorInjectionProtectionMode", + "ModelAvailabilityAccountGuardrailPolicy", + "ModelAvailabilityAccountGuardrailPolicyPolicyType", + "ModelAvailabilityAccountGuardrailPolicyRequest", + "ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignment", + "ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignmentTypedDict", + "ModelAvailabilityAccountGuardrailPolicyRequestPolicyType", + "ModelAvailabilityAccountGuardrailPolicyRequestTypedDict", + "ModelAvailabilityAccountGuardrailPolicyTypedDict", + "ModelAvailabilityGuardrailPolicy", + "ModelAvailabilityGuardrailPolicyDetail", + "ModelAvailabilityGuardrailPolicyDetailPolicyType", + "ModelAvailabilityGuardrailPolicyDetailReference", + "ModelAvailabilityGuardrailPolicyDetailResponse", + "ModelAvailabilityGuardrailPolicyDetailResponseTypedDict", + "ModelAvailabilityGuardrailPolicyDetailTypedDict", + "ModelAvailabilityGuardrailPolicyPolicyType", + "ModelAvailabilityGuardrailPolicyResponse", + "ModelAvailabilityGuardrailPolicyResponseTypedDict", + "ModelAvailabilityGuardrailPolicySummary", + "ModelAvailabilityGuardrailPolicySummaryPolicyType", + "ModelAvailabilityGuardrailPolicySummaryTypedDict", + "ModelAvailabilityGuardrailPolicyTypedDict", "ModelBenchmarks", "ModelBenchmarksTypedDict", "ModelGroup", @@ -6937,6 +7263,28 @@ "ModelsListResponseLinksTypedDict", "ModelsListResponseTypedDict", "Moderation", + "ModerationAccountGuardrailPolicy", + "ModerationAccountGuardrailPolicyPolicyType", + "ModerationAccountGuardrailPolicyRequest", + "ModerationAccountGuardrailPolicyRequestFloorReassignment", + "ModerationAccountGuardrailPolicyRequestFloorReassignmentTypedDict", + "ModerationAccountGuardrailPolicyRequestPolicyType", + "ModerationAccountGuardrailPolicyRequestTypedDict", + "ModerationAccountGuardrailPolicyTypedDict", + "ModerationGuardrailPolicy", + "ModerationGuardrailPolicyDetail", + "ModerationGuardrailPolicyDetailPolicyType", + "ModerationGuardrailPolicyDetailReference", + "ModerationGuardrailPolicyDetailResponse", + "ModerationGuardrailPolicyDetailResponseTypedDict", + "ModerationGuardrailPolicyDetailTypedDict", + "ModerationGuardrailPolicyPolicyType", + "ModerationGuardrailPolicyResponse", + "ModerationGuardrailPolicyResponseTypedDict", + "ModerationGuardrailPolicySummary", + "ModerationGuardrailPolicySummaryPolicyType", + "ModerationGuardrailPolicySummaryTypedDict", + "ModerationGuardrailPolicyTypedDict", "ModerationPlugin", "ModerationPluginID", "ModerationPluginTypedDict", @@ -7085,7 +7433,6 @@ "ObservabilityWebhookDestinationMethod", "ObservabilityWebhookDestinationType", "ObservabilityWebhookDestinationTypedDict", - "OnError", "OpenAIFile", "OpenAIFileDeleted", "OpenAIFileDeletedObject", @@ -7354,6 +7701,7 @@ "OutputItems", "OutputItemsTypedDict", "OutputMemoryServerToolItem", + "OutputMemoryServerToolItemAction", "OutputMemoryServerToolItemType", "OutputMemoryServerToolItemTypedDict", "OutputMessage", @@ -7496,6 +7844,9 @@ "PercentileThroughputCutoffsTypedDict", "PerfLast30mByWorkload", "PerfLast30mByWorkloadTypedDict", + "PiiFilter", + "PiiFilterAction", + "PiiFilterTypedDict", "PipelineStage", "PipelineStageType", "PipelineStageTypedDict", @@ -7783,6 +8134,7 @@ "ScalarFilterTypedDict", "ScalarFilterValue", "ScalarFilterValueTypedDict", + "ScanScope", "ScimGroup", "ScimGroupMapping", "ScimGroupMappingRole", @@ -7875,6 +8227,7 @@ "SlackMemberLink", "SlackMemberLinkTypedDict", "SlackTypedDict", + "Slug", "SoftDeny", "SoftDenyTypedDict", "SourceContent", @@ -8185,6 +8538,7 @@ "UniqueInsightTypedDict", "Unit", "Unknown", + "UnknownAccountGuardrailPolicy", "UnknownAlignmentCallRecord", "UnknownAlignmentResponsesRejected", "UnknownAnnotation", @@ -8241,12 +8595,18 @@ "UpdateBYOKKeyRequestTypedDict", "UpdateBYOKKeyResponse", "UpdateBYOKKeyResponseTypedDict", + "UpdateBudgetGuardrailPolicyRequest", + "UpdateBudgetGuardrailPolicyRequestTypedDict", "UpdateExternalUserRequest", "UpdateExternalUserRequestTypedDict", "UpdateGuardrailRequest", "UpdateGuardrailRequestTypedDict", "UpdateGuardrailResponse", "UpdateGuardrailResponseTypedDict", + "UpdateModelAvailabilityGuardrailPolicyRequest", + "UpdateModelAvailabilityGuardrailPolicyRequestTypedDict", + "UpdateModerationGuardrailPolicyRequest", + "UpdateModerationGuardrailPolicyRequestTypedDict", "UpdateObservabilityDestinationRequest", "UpdateObservabilityDestinationRequestTypedDict", "UpdateObservabilityDestinationResponse", @@ -8415,6 +8775,13 @@ _dynamic_imports: dict[str, str] = { "AABenchmarkEntry": ".aabenchmarkentry", "AABenchmarkEntryTypedDict": ".aabenchmarkentry", + "AccountGuardrailPolicy": ".accountguardrailpolicy", + "AccountGuardrailPolicyTypedDict": ".accountguardrailpolicy", + "UnknownAccountGuardrailPolicy": ".accountguardrailpolicy", + "AccountGuardrailPolicyRequest": ".accountguardrailpolicyrequest", + "AccountGuardrailPolicyRequestTypedDict": ".accountguardrailpolicyrequest", + "AccountGuardrailPolicyResponse": ".accountguardrailpolicyresponse", + "AccountGuardrailPolicyResponseTypedDict": ".accountguardrailpolicyresponse", "ActivityItem": ".activityitem", "ActivityItemTypedDict": ".activityitem", "ActivityResponse": ".activityresponse", @@ -8890,8 +9257,8 @@ "ArmorPlugin": ".armorplugin", "ArmorPluginID": ".armorplugin", "ArmorPluginMode": ".armorplugin", + "ArmorPluginOnError": ".armorplugin", "ArmorPluginTypedDict": ".armorplugin", - "OnError": ".armorplugin", "OutputMode": ".armorplugin", "ArmorRule": ".armorrule", "ArmorRuleTypedDict": ".armorrule", @@ -9136,6 +9503,28 @@ "BooleanCapability": ".booleancapability", "BooleanCapabilityType": ".booleancapability", "BooleanCapabilityTypedDict": ".booleancapability", + "BudgetAccountGuardrailPolicy": ".budgetaccountguardrailpolicy", + "BudgetAccountGuardrailPolicyPolicyType": ".budgetaccountguardrailpolicy", + "BudgetAccountGuardrailPolicyTypedDict": ".budgetaccountguardrailpolicy", + "BudgetAccountGuardrailPolicyRequest": ".budgetaccountguardrailpolicyrequest", + "BudgetAccountGuardrailPolicyRequestFloorReassignment": ".budgetaccountguardrailpolicyrequest", + "BudgetAccountGuardrailPolicyRequestFloorReassignmentTypedDict": ".budgetaccountguardrailpolicyrequest", + "BudgetAccountGuardrailPolicyRequestPolicyType": ".budgetaccountguardrailpolicyrequest", + "BudgetAccountGuardrailPolicyRequestTypedDict": ".budgetaccountguardrailpolicyrequest", + "BudgetGuardrailPolicy": ".budgetguardrailpolicy", + "BudgetGuardrailPolicyPolicyType": ".budgetguardrailpolicy", + "BudgetGuardrailPolicyTypedDict": ".budgetguardrailpolicy", + "BudgetGuardrailPolicyDetail": ".budgetguardrailpolicydetail", + "BudgetGuardrailPolicyDetailPolicyType": ".budgetguardrailpolicydetail", + "BudgetGuardrailPolicyDetailReference": ".budgetguardrailpolicydetail", + "BudgetGuardrailPolicyDetailTypedDict": ".budgetguardrailpolicydetail", + "BudgetGuardrailPolicyDetailResponse": ".budgetguardrailpolicydetailresponse", + "BudgetGuardrailPolicyDetailResponseTypedDict": ".budgetguardrailpolicydetailresponse", + "BudgetGuardrailPolicyResponse": ".budgetguardrailpolicyresponse", + "BudgetGuardrailPolicyResponseTypedDict": ".budgetguardrailpolicyresponse", + "BudgetGuardrailPolicySummary": ".budgetguardrailpolicysummary", + "BudgetGuardrailPolicySummaryPolicyType": ".budgetguardrailpolicysummary", + "BudgetGuardrailPolicySummaryTypedDict": ".budgetguardrailpolicysummary", "BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse", @@ -9167,6 +9556,11 @@ "CapabilityDescriptor": ".capabilitydescriptor", "CapabilityDescriptorTypedDict": ".capabilitydescriptor", "UnknownCapabilityDescriptor": ".capabilitydescriptor", + "ChangeGuardrailPolicyAssignmentRequest": ".changeguardrailpolicyassignmentrequest", + "ChangeGuardrailPolicyAssignmentRequestPolicyType": ".changeguardrailpolicyassignmentrequest", + "ChangeGuardrailPolicyAssignmentRequestTypedDict": ".changeguardrailpolicyassignmentrequest", + "ChangeGuardrailPolicyAssignmentResponse": ".changeguardrailpolicyassignmentresponse", + "ChangeGuardrailPolicyAssignmentResponseTypedDict": ".changeguardrailpolicyassignmentresponse", "ChatAssistantImages": ".chatassistantimages", "ChatAssistantImagesImageURL": ".chatassistantimages", "ChatAssistantImagesImageURLTypedDict": ".chatassistantimages", @@ -9484,6 +9878,9 @@ "ContextCompressionPluginTypedDict": ".contextcompressionplugin", "CostDetails": ".costdetails", "CostDetailsTypedDict": ".costdetails", + "CreateBudgetGuardrailPolicyRequest": ".createbudgetguardrailpolicyrequest", + "CreateBudgetGuardrailPolicyRequestPolicyType": ".createbudgetguardrailpolicyrequest", + "CreateBudgetGuardrailPolicyRequestTypedDict": ".createbudgetguardrailpolicyrequest", "CreateBYOKKeyRequest": ".createbyokkeyrequest", "CreateBYOKKeyRequestDeclaredRegion": ".createbyokkeyrequest", "CreateBYOKKeyRequestTypedDict": ".createbyokkeyrequest", @@ -9495,6 +9892,12 @@ "CreateGuardrailRequestTypedDict": ".createguardrailrequest", "CreateGuardrailResponse": ".createguardrailresponse", "CreateGuardrailResponseTypedDict": ".createguardrailresponse", + "CreateModelAvailabilityGuardrailPolicyRequest": ".createmodelavailabilityguardrailpolicyrequest", + "CreateModelAvailabilityGuardrailPolicyRequestPolicyType": ".createmodelavailabilityguardrailpolicyrequest", + "CreateModelAvailabilityGuardrailPolicyRequestTypedDict": ".createmodelavailabilityguardrailpolicyrequest", + "CreateModerationGuardrailPolicyRequest": ".createmoderationguardrailpolicyrequest", + "CreateModerationGuardrailPolicyRequestPolicyType": ".createmoderationguardrailpolicyrequest", + "CreateModerationGuardrailPolicyRequestTypedDict": ".createmoderationguardrailpolicyrequest", "CreateObservabilityDestinationRequest": ".createobservabilitydestinationrequest", "CreateObservabilityDestinationRequestType": ".createobservabilitydestinationrequest", "CreateObservabilityDestinationRequestTypedDict": ".createobservabilitydestinationrequest", @@ -9668,6 +10071,8 @@ "DeferredToolsSearchStrategyTypedDict": ".deferredtoolssearchstrategy", "DeleteBYOKKeyResponse": ".deletebyokkeyresponse", "DeleteBYOKKeyResponseTypedDict": ".deletebyokkeyresponse", + "DeleteGuardrailPolicyResponse": ".deleteguardrailpolicyresponse", + "DeleteGuardrailPolicyResponseTypedDict": ".deleteguardrailpolicyresponse", "DeleteGuardrailResponse": ".deleteguardrailresponse", "DeleteGuardrailResponseTypedDict": ".deleteguardrailresponse", "DeleteObservabilityDestinationResponse": ".deleteobservabilitydestinationresponse", @@ -10062,8 +10467,41 @@ "GoneResponseErrorDataTypedDict": ".goneresponseerrordata", "Guardrail": ".guardrail", "GuardrailTypedDict": ".guardrail", + "GuardrailBudgetPolicyAuthoringConfig": ".guardrailbudgetpolicyauthoringconfig", + "GuardrailBudgetPolicyAuthoringConfigResetInterval": ".guardrailbudgetpolicyauthoringconfig", + "GuardrailBudgetPolicyAuthoringConfigTypedDict": ".guardrailbudgetpolicyauthoringconfig", + "GuardrailBudgetPolicyConfig": ".guardrailbudgetpolicyconfig", + "GuardrailBudgetPolicyConfigTypedDict": ".guardrailbudgetpolicyconfig", "GuardrailDataRegion": ".guardraildataregion", "GuardrailInterval": ".guardrailinterval", + "GuardrailModelAvailabilityPolicyAuthoringConfig": ".guardrailmodelavailabilitypolicyauthoringconfig", + "GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict": ".guardrailmodelavailabilitypolicyauthoringconfig", + "GuardrailModelAvailabilityPolicyConfig": ".guardrailmodelavailabilitypolicyconfig", + "GuardrailModelAvailabilityPolicyConfigTypedDict": ".guardrailmodelavailabilitypolicyconfig", + "Armor": ".guardrailmoderationpolicyconfig", + "ArmorTypedDict": ".guardrailmoderationpolicyconfig", + "ContentFilter": ".guardrailmoderationpolicyconfig", + "ContentFilterBuiltin": ".guardrailmoderationpolicyconfig", + "ContentFilterBuiltinTypedDict": ".guardrailmoderationpolicyconfig", + "ContentFilterTypedDict": ".guardrailmoderationpolicyconfig", + "GuardrailModerationPolicyConfig": ".guardrailmoderationpolicyconfig", + "GuardrailModerationPolicyConfigContentFilterAction": ".guardrailmoderationpolicyconfig", + "GuardrailModerationPolicyConfigContentFilterBuiltinAction": ".guardrailmoderationpolicyconfig", + "GuardrailModerationPolicyConfigMode": ".guardrailmoderationpolicyconfig", + "GuardrailModerationPolicyConfigOnError": ".guardrailmoderationpolicyconfig", + "GuardrailModerationPolicyConfigTypedDict": ".guardrailmoderationpolicyconfig", + "LakeraInjectionProtectionMode": ".guardrailmoderationpolicyconfig", + "ModelArmorInjectionConfidenceLevel": ".guardrailmoderationpolicyconfig", + "ModelArmorInjectionProtectionMode": ".guardrailmoderationpolicyconfig", + "PiiFilter": ".guardrailmoderationpolicyconfig", + "PiiFilterAction": ".guardrailmoderationpolicyconfig", + "PiiFilterTypedDict": ".guardrailmoderationpolicyconfig", + "ScanScope": ".guardrailmoderationpolicyconfig", + "Slug": ".guardrailmoderationpolicyconfig", + "GuardrailPolicyAssignmentResponse": ".guardrailpolicyassignmentresponse", + "GuardrailPolicyAssignmentResponseTypedDict": ".guardrailpolicyassignmentresponse", + "GuardrailPolicyAssignmentState": ".guardrailpolicyassignmentstate", + "GuardrailPolicyAssignmentStateTypedDict": ".guardrailpolicyassignmentstate", "ImageConfig": ".imageconfig", "ImageConfigTypedDict": ".imageconfig", "ImageEndpoint": ".imageendpoint", @@ -10263,6 +10701,10 @@ "LegacyWebSearchServerTool": ".legacy_websearchservertool", "LegacyWebSearchServerToolType": ".legacy_websearchservertool", "LegacyWebSearchServerToolTypedDict": ".legacy_websearchservertool", + "ListAccountGuardrailPoliciesResponse": ".listaccountguardrailpoliciesresponse", + "ListAccountGuardrailPoliciesResponseTypedDict": ".listaccountguardrailpoliciesresponse", + "ListBudgetGuardrailPoliciesResponse": ".listbudgetguardrailpoliciesresponse", + "ListBudgetGuardrailPoliciesResponseTypedDict": ".listbudgetguardrailpoliciesresponse", "ListBYOKKeysResponse": ".listbyokkeysresponse", "ListBYOKKeysResponseTypedDict": ".listbyokkeysresponse", "Architecture": ".listendpointsresponse", @@ -10277,6 +10719,10 @@ "ListKeyAssignmentsResponseTypedDict": ".listkeyassignmentsresponse", "ListMemberAssignmentsResponse": ".listmemberassignmentsresponse", "ListMemberAssignmentsResponseTypedDict": ".listmemberassignmentsresponse", + "ListModelAvailabilityGuardrailPoliciesResponse": ".listmodelavailabilityguardrailpoliciesresponse", + "ListModelAvailabilityGuardrailPoliciesResponseTypedDict": ".listmodelavailabilityguardrailpoliciesresponse", + "ListModerationGuardrailPoliciesResponse": ".listmoderationguardrailpoliciesresponse", + "ListModerationGuardrailPoliciesResponseTypedDict": ".listmoderationguardrailpoliciesresponse", "ListObservabilityDestinationsResponse": ".listobservabilitydestinationsresponse", "ListObservabilityDestinationsResponseTypedDict": ".listobservabilitydestinationsresponse", "ListPresetsResponse": ".listpresetsresponse", @@ -10600,6 +11046,28 @@ "ModelAliasTargetTypedDict": ".modelaliastarget", "ModelArchitecture": ".modelarchitecture", "ModelArchitectureTypedDict": ".modelarchitecture", + "ModelAvailabilityAccountGuardrailPolicy": ".modelavailabilityaccountguardrailpolicy", + "ModelAvailabilityAccountGuardrailPolicyPolicyType": ".modelavailabilityaccountguardrailpolicy", + "ModelAvailabilityAccountGuardrailPolicyTypedDict": ".modelavailabilityaccountguardrailpolicy", + "ModelAvailabilityAccountGuardrailPolicyRequest": ".modelavailabilityaccountguardrailpolicyrequest", + "ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignment": ".modelavailabilityaccountguardrailpolicyrequest", + "ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignmentTypedDict": ".modelavailabilityaccountguardrailpolicyrequest", + "ModelAvailabilityAccountGuardrailPolicyRequestPolicyType": ".modelavailabilityaccountguardrailpolicyrequest", + "ModelAvailabilityAccountGuardrailPolicyRequestTypedDict": ".modelavailabilityaccountguardrailpolicyrequest", + "ModelAvailabilityGuardrailPolicy": ".modelavailabilityguardrailpolicy", + "ModelAvailabilityGuardrailPolicyPolicyType": ".modelavailabilityguardrailpolicy", + "ModelAvailabilityGuardrailPolicyTypedDict": ".modelavailabilityguardrailpolicy", + "ModelAvailabilityGuardrailPolicyDetail": ".modelavailabilityguardrailpolicydetail", + "ModelAvailabilityGuardrailPolicyDetailPolicyType": ".modelavailabilityguardrailpolicydetail", + "ModelAvailabilityGuardrailPolicyDetailReference": ".modelavailabilityguardrailpolicydetail", + "ModelAvailabilityGuardrailPolicyDetailTypedDict": ".modelavailabilityguardrailpolicydetail", + "ModelAvailabilityGuardrailPolicyDetailResponse": ".modelavailabilityguardrailpolicydetailresponse", + "ModelAvailabilityGuardrailPolicyDetailResponseTypedDict": ".modelavailabilityguardrailpolicydetailresponse", + "ModelAvailabilityGuardrailPolicyResponse": ".modelavailabilityguardrailpolicyresponse", + "ModelAvailabilityGuardrailPolicyResponseTypedDict": ".modelavailabilityguardrailpolicyresponse", + "ModelAvailabilityGuardrailPolicySummary": ".modelavailabilityguardrailpolicysummary", + "ModelAvailabilityGuardrailPolicySummaryPolicyType": ".modelavailabilityguardrailpolicysummary", + "ModelAvailabilityGuardrailPolicySummaryTypedDict": ".modelavailabilityguardrailpolicysummary", "ModelBenchmarks": ".modelbenchmarks", "ModelBenchmarksTypedDict": ".modelbenchmarks", "ModelGroup": ".modelgroup", @@ -10618,6 +11086,28 @@ "ModelsListResponseLinks": ".modelslistresponse", "ModelsListResponseLinksTypedDict": ".modelslistresponse", "ModelsListResponseTypedDict": ".modelslistresponse", + "ModerationAccountGuardrailPolicy": ".moderationaccountguardrailpolicy", + "ModerationAccountGuardrailPolicyPolicyType": ".moderationaccountguardrailpolicy", + "ModerationAccountGuardrailPolicyTypedDict": ".moderationaccountguardrailpolicy", + "ModerationAccountGuardrailPolicyRequest": ".moderationaccountguardrailpolicyrequest", + "ModerationAccountGuardrailPolicyRequestFloorReassignment": ".moderationaccountguardrailpolicyrequest", + "ModerationAccountGuardrailPolicyRequestFloorReassignmentTypedDict": ".moderationaccountguardrailpolicyrequest", + "ModerationAccountGuardrailPolicyRequestPolicyType": ".moderationaccountguardrailpolicyrequest", + "ModerationAccountGuardrailPolicyRequestTypedDict": ".moderationaccountguardrailpolicyrequest", + "ModerationGuardrailPolicy": ".moderationguardrailpolicy", + "ModerationGuardrailPolicyPolicyType": ".moderationguardrailpolicy", + "ModerationGuardrailPolicyTypedDict": ".moderationguardrailpolicy", + "ModerationGuardrailPolicyDetail": ".moderationguardrailpolicydetail", + "ModerationGuardrailPolicyDetailPolicyType": ".moderationguardrailpolicydetail", + "ModerationGuardrailPolicyDetailReference": ".moderationguardrailpolicydetail", + "ModerationGuardrailPolicyDetailTypedDict": ".moderationguardrailpolicydetail", + "ModerationGuardrailPolicyDetailResponse": ".moderationguardrailpolicydetailresponse", + "ModerationGuardrailPolicyDetailResponseTypedDict": ".moderationguardrailpolicydetailresponse", + "ModerationGuardrailPolicyResponse": ".moderationguardrailpolicyresponse", + "ModerationGuardrailPolicyResponseTypedDict": ".moderationguardrailpolicyresponse", + "ModerationGuardrailPolicySummary": ".moderationguardrailpolicysummary", + "ModerationGuardrailPolicySummaryPolicyType": ".moderationguardrailpolicysummary", + "ModerationGuardrailPolicySummaryTypedDict": ".moderationguardrailpolicysummary", "ModerationPlugin": ".moderationplugin", "ModerationPluginID": ".moderationplugin", "ModerationPluginTypedDict": ".moderationplugin", @@ -11078,8 +11568,8 @@ "OutputItemWebSearchCallTypeWebSearchCall": ".outputitemwebsearchcall", "OutputItemWebSearchCallTypedDict": ".outputitemwebsearchcall", "UnknownOutputItemWebSearchCallActionUnion": ".outputitemwebsearchcall", - "ActionEnum": ".outputmemoryservertoolitem", "OutputMemoryServerToolItem": ".outputmemoryservertoolitem", + "OutputMemoryServerToolItemAction": ".outputmemoryservertoolitem", "OutputMemoryServerToolItemType": ".outputmemoryservertoolitem", "OutputMemoryServerToolItemTypedDict": ".outputmemoryservertoolitem", "OutputMessage": ".outputmessage", @@ -11780,6 +12270,8 @@ "UnknownTypedDict": ".unknown", "UnprocessableEntityResponseErrorData": ".unprocessableentityresponseerrordata", "UnprocessableEntityResponseErrorDataTypedDict": ".unprocessableentityresponseerrordata", + "UpdateBudgetGuardrailPolicyRequest": ".updatebudgetguardrailpolicyrequest", + "UpdateBudgetGuardrailPolicyRequestTypedDict": ".updatebudgetguardrailpolicyrequest", "UpdateBYOKKeyRequest": ".updatebyokkeyrequest", "UpdateBYOKKeyRequestDeclaredRegion": ".updatebyokkeyrequest", "UpdateBYOKKeyRequestTypedDict": ".updatebyokkeyrequest", @@ -11791,6 +12283,10 @@ "UpdateGuardrailRequestTypedDict": ".updateguardrailrequest", "UpdateGuardrailResponse": ".updateguardrailresponse", "UpdateGuardrailResponseTypedDict": ".updateguardrailresponse", + "UpdateModelAvailabilityGuardrailPolicyRequest": ".updatemodelavailabilityguardrailpolicyrequest", + "UpdateModelAvailabilityGuardrailPolicyRequestTypedDict": ".updatemodelavailabilityguardrailpolicyrequest", + "UpdateModerationGuardrailPolicyRequest": ".updatemoderationguardrailpolicyrequest", + "UpdateModerationGuardrailPolicyRequestTypedDict": ".updatemoderationguardrailpolicyrequest", "UpdateObservabilityDestinationRequest": ".updateobservabilitydestinationrequest", "UpdateObservabilityDestinationRequestTypedDict": ".updateobservabilitydestinationrequest", "UpdateObservabilityDestinationResponse": ".updateobservabilitydestinationresponse", diff --git a/src/openrouter/components/accountguardrailpolicy.py b/src/openrouter/components/accountguardrailpolicy.py new file mode 100644 index 000000000..ba9e3ea0c --- /dev/null +++ b/src/openrouter/components/accountguardrailpolicy.py @@ -0,0 +1,68 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .budgetaccountguardrailpolicy import ( + BudgetAccountGuardrailPolicy, + BudgetAccountGuardrailPolicyTypedDict, +) +from .modelavailabilityaccountguardrailpolicy import ( + ModelAvailabilityAccountGuardrailPolicy, + ModelAvailabilityAccountGuardrailPolicyTypedDict, +) +from .moderationaccountguardrailpolicy import ( + ModerationAccountGuardrailPolicy, + ModerationAccountGuardrailPolicyTypedDict, +) +from functools import partial +from openrouter.types import BaseModel +from openrouter.utils.unions import parse_open_union +from pydantic import ConfigDict +from pydantic.functional_validators import BeforeValidator +from typing import Any, Literal, Union +from typing_extensions import Annotated, TypeAliasType + + +AccountGuardrailPolicyTypedDict = TypeAliasType( + "AccountGuardrailPolicyTypedDict", + Union[ + BudgetAccountGuardrailPolicyTypedDict, + ModerationAccountGuardrailPolicyTypedDict, + ModelAvailabilityAccountGuardrailPolicyTypedDict, + ], +) + + +class UnknownAccountGuardrailPolicy(BaseModel): + r"""A AccountGuardrailPolicy variant the SDK doesn't recognize. Preserves the raw payload.""" + + policy_type: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_ACCOUNT_GUARDRAIL_POLICY_VARIANTS: dict[str, Any] = { + "budget": BudgetAccountGuardrailPolicy, + "model_availability": ModelAvailabilityAccountGuardrailPolicy, + "moderation": ModerationAccountGuardrailPolicy, +} + + +AccountGuardrailPolicy = Annotated[ + Union[ + BudgetAccountGuardrailPolicy, + ModelAvailabilityAccountGuardrailPolicy, + ModerationAccountGuardrailPolicy, + UnknownAccountGuardrailPolicy, + ], + BeforeValidator( + partial( + parse_open_union, + disc_key="policy_type", + variants=_ACCOUNT_GUARDRAIL_POLICY_VARIANTS, + unknown_cls=UnknownAccountGuardrailPolicy, + union_name="AccountGuardrailPolicy", + ) + ), +] diff --git a/src/openrouter/components/accountguardrailpolicyrequest.py b/src/openrouter/components/accountguardrailpolicyrequest.py new file mode 100644 index 000000000..48bf26eb4 --- /dev/null +++ b/src/openrouter/components/accountguardrailpolicyrequest.py @@ -0,0 +1,41 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .budgetaccountguardrailpolicyrequest import ( + BudgetAccountGuardrailPolicyRequest, + BudgetAccountGuardrailPolicyRequestTypedDict, +) +from .modelavailabilityaccountguardrailpolicyrequest import ( + ModelAvailabilityAccountGuardrailPolicyRequest, + ModelAvailabilityAccountGuardrailPolicyRequestTypedDict, +) +from .moderationaccountguardrailpolicyrequest import ( + ModerationAccountGuardrailPolicyRequest, + ModerationAccountGuardrailPolicyRequestTypedDict, +) +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag +from typing import Union +from typing_extensions import Annotated, TypeAliasType + + +AccountGuardrailPolicyRequestTypedDict = TypeAliasType( + "AccountGuardrailPolicyRequestTypedDict", + Union[ + BudgetAccountGuardrailPolicyRequestTypedDict, + ModerationAccountGuardrailPolicyRequestTypedDict, + ModelAvailabilityAccountGuardrailPolicyRequestTypedDict, + ], +) + + +AccountGuardrailPolicyRequest = Annotated[ + Union[ + Annotated[BudgetAccountGuardrailPolicyRequest, Tag("budget")], + Annotated[ + ModelAvailabilityAccountGuardrailPolicyRequest, Tag("model_availability") + ], + Annotated[ModerationAccountGuardrailPolicyRequest, Tag("moderation")], + ], + Discriminator(lambda m: get_discriminator(m, "policy_type", "policy_type")), +] diff --git a/src/openrouter/components/accountguardrailpolicyresponse.py b/src/openrouter/components/accountguardrailpolicyresponse.py new file mode 100644 index 000000000..c8ad7b168 --- /dev/null +++ b/src/openrouter/components/accountguardrailpolicyresponse.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .accountguardrailpolicy import ( + AccountGuardrailPolicy, + AccountGuardrailPolicyTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class AccountGuardrailPolicyResponseTypedDict(TypedDict): + data: AccountGuardrailPolicyTypedDict + + +class AccountGuardrailPolicyResponse(BaseModel): + data: AccountGuardrailPolicy diff --git a/src/openrouter/components/armorplugin.py b/src/openrouter/components/armorplugin.py index 4ce09db97..1af867757 100644 --- a/src/openrouter/components/armorplugin.py +++ b/src/openrouter/components/armorplugin.py @@ -21,7 +21,7 @@ r"""`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.""" -OnError = Union[ +ArmorPluginOnError = Union[ Literal[ "log", "block", @@ -54,7 +54,7 @@ class ArmorPluginTypedDict(TypedDict): r"""Run provider-native server tools (web search, code execution, ...) through the agent loop so Armor evaluates them too. Defaults to false: native passthrough stands and such calls are reported `skipped`.""" mode: NotRequired[ArmorPluginMode] r"""`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.""" - on_error: NotRequired[OnError] + on_error: NotRequired[ArmorPluginOnError] r"""When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.""" output_mode: NotRequired[OutputMode] r"""How a blocked call reaches the caller. `text` (the default): the call is withheld and an `` marker stands in assistant text. `custom_item` (Responses API only): the call is withheld and an `openrouter:armor_blocked` output item carries its id, name, arguments and the rule that fired. `claude_code_compatibility` (Messages API only; the default when the request carries a `dangerous_tool_use` safeguard, i.e. the client speaks Claude Code's protocol): the `tool_use` stays in `content[]` and the verdict is `flagged` in `safeguard_results`, so the client withholds execution and writes the error tool result as under the native classifier. Under `text` and `custom_item` the model received a failure result in the loop and continued in the same request; under `claude_code_compatibility` the turn ends on the flagged call and the model continues on the next request, after the client's denial.""" @@ -79,7 +79,7 @@ class ArmorPlugin(BaseModel): mode: Optional[ArmorPluginMode] = None r"""`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.""" - on_error: Optional[OnError] = None + on_error: Optional[ArmorPluginOnError] = None r"""When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.""" output_mode: Optional[OutputMode] = None diff --git a/src/openrouter/components/budgetaccountguardrailpolicy.py b/src/openrouter/components/budgetaccountguardrailpolicy.py new file mode 100644 index 000000000..cf6ac52ce --- /dev/null +++ b/src/openrouter/components/budgetaccountguardrailpolicy.py @@ -0,0 +1,77 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailbudgetpolicyconfig import ( + GuardrailBudgetPolicyConfig, + GuardrailBudgetPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal +from typing_extensions import TypedDict + + +BudgetAccountGuardrailPolicyPolicyType = Literal["budget",] + + +class BudgetAccountGuardrailPolicyTypedDict(TypedDict): + config: GuardrailBudgetPolicyConfigTypedDict + created_at: str + id: str + r"""Policy ID""" + is_default: bool + is_synced: bool + r"""Kept in sync with a v1 guardrail; saving changes creates an account copy""" + is_workspace_default_synced: bool + r"""Synced from a v1 workspace default guardrail""" + name: str + r"""Policy name""" + opted_out_workspace_ids: List[str] + policy_type: BudgetAccountGuardrailPolicyPolicyType + updated_at: Nullable[str] + workspace_count: int + workspace_ids: List[str] + + +class BudgetAccountGuardrailPolicy(BaseModel): + config: GuardrailBudgetPolicyConfig + + created_at: str + + id: str + r"""Policy ID""" + + is_default: bool + + is_synced: bool + r"""Kept in sync with a v1 guardrail; saving changes creates an account copy""" + + is_workspace_default_synced: bool + r"""Synced from a v1 workspace default guardrail""" + + name: str + r"""Policy name""" + + opted_out_workspace_ids: List[str] + + policy_type: BudgetAccountGuardrailPolicyPolicyType + + updated_at: Nullable[str] + + workspace_count: int + + workspace_ids: List[str] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/budgetaccountguardrailpolicyrequest.py b/src/openrouter/components/budgetaccountguardrailpolicyrequest.py new file mode 100644 index 000000000..384e0fcee --- /dev/null +++ b/src/openrouter/components/budgetaccountguardrailpolicyrequest.py @@ -0,0 +1,106 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailbudgetpolicyauthoringconfig import ( + GuardrailBudgetPolicyAuthoringConfig, + GuardrailBudgetPolicyAuthoringConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +class BudgetAccountGuardrailPolicyRequestFloorReassignmentTypedDict(TypedDict): + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + policy_id: str + r"""Policy ID""" + workspace_ids: List[str] + + +class BudgetAccountGuardrailPolicyRequestFloorReassignment(BaseModel): + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + policy_id: str + r"""Policy ID""" + + workspace_ids: List[str] + + +BudgetAccountGuardrailPolicyRequestPolicyType = Literal["budget",] + + +class BudgetAccountGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailBudgetPolicyAuthoringConfigTypedDict + name: str + r"""Policy name""" + policy_type: BudgetAccountGuardrailPolicyRequestPolicyType + floor_reassignment: NotRequired[ + BudgetAccountGuardrailPolicyRequestFloorReassignmentTypedDict + ] + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + is_default: NotRequired[bool] + r"""Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.""" + keep_previous_default_workspaces: NotRequired[bool] + r"""Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.""" + opted_out_workspace_ids: NotRequired[List[str]] + r"""Workspaces left out of a default policy""" + released_floor_workspace_ids: NotRequired[List[str]] + r"""Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default""" + workspace_ids: NotRequired[List[str]] + r"""Workspaces the policy covers when it is not the default""" + + +class BudgetAccountGuardrailPolicyRequest(BaseModel): + config: GuardrailBudgetPolicyAuthoringConfig + + name: str + r"""Policy name""" + + policy_type: BudgetAccountGuardrailPolicyRequestPolicyType + + floor_reassignment: Optional[ + BudgetAccountGuardrailPolicyRequestFloorReassignment + ] = None + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + is_default: Optional[bool] = None + r"""Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.""" + + keep_previous_default_workspaces: Optional[bool] = None + r"""Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.""" + + opted_out_workspace_ids: Optional[List[str]] = None + r"""Workspaces left out of a default policy""" + + released_floor_workspace_ids: Optional[List[str]] = None + r"""Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default""" + + workspace_ids: Optional[List[str]] = None + r"""Workspaces the policy covers when it is not the default""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "floor_reassignment", + "is_default", + "keep_previous_default_workspaces", + "opted_out_workspace_ids", + "released_floor_workspace_ids", + "workspace_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/budgetguardrailpolicy.py b/src/openrouter/components/budgetguardrailpolicy.py new file mode 100644 index 000000000..40183ab5b --- /dev/null +++ b/src/openrouter/components/budgetguardrailpolicy.py @@ -0,0 +1,34 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailbudgetpolicyconfig import ( + GuardrailBudgetPolicyConfig, + GuardrailBudgetPolicyConfigTypedDict, +) +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +BudgetGuardrailPolicyPolicyType = Literal["budget",] + + +class BudgetGuardrailPolicyTypedDict(TypedDict): + config: GuardrailBudgetPolicyConfigTypedDict + id: str + r"""Policy ID""" + name: str + r"""Policy name""" + policy_type: BudgetGuardrailPolicyPolicyType + + +class BudgetGuardrailPolicy(BaseModel): + config: GuardrailBudgetPolicyConfig + + id: str + r"""Policy ID""" + + name: str + r"""Policy name""" + + policy_type: BudgetGuardrailPolicyPolicyType diff --git a/src/openrouter/components/budgetguardrailpolicydetail.py b/src/openrouter/components/budgetguardrailpolicydetail.py new file mode 100644 index 000000000..671bdcfb2 --- /dev/null +++ b/src/openrouter/components/budgetguardrailpolicydetail.py @@ -0,0 +1,134 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailbudgetpolicyconfig import ( + GuardrailBudgetPolicyConfig, + GuardrailBudgetPolicyConfigTypedDict, +) +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET_SENTINEL, + UnrecognizedStr, +) +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict + + +BudgetGuardrailPolicyDetailPolicyType = Literal["budget",] + + +BudgetGuardrailPolicyDetailReference = Union[ + Literal[ + "legacy_mapping", + "account_default", + ], + UnrecognizedStr, +] +r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + + +class BudgetGuardrailPolicyDetailTypedDict(TypedDict): + api_key_hashes: List[str] + r"""API key hashes""" + config: GuardrailBudgetPolicyConfigTypedDict + id: str + r"""Policy ID""" + member_ids: List[str] + r"""Organization member user IDs""" + name: str + r"""Policy name""" + opted_out_api_key_hashes: List[str] + r"""API key hashes""" + overridden_api_key_hashes: List[str] + r"""API keys that have a different policy of this type assigned directly""" + policy_type: BudgetGuardrailPolicyDetailPolicyType + updated_at: Nullable[str] + is_workspace_default: NotRequired[bool] + opted_out_member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + overridden_member_ids: NotRequired[List[str]] + r"""Members that have a different policy of this type assigned directly""" + reference: NotRequired[Nullable[BudgetGuardrailPolicyDetailReference]] + r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + replaces_legacy_default: NotRequired[bool] + r"""Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted""" + + +class BudgetGuardrailPolicyDetail(BaseModel): + api_key_hashes: List[str] + r"""API key hashes""" + + config: GuardrailBudgetPolicyConfig + + id: str + r"""Policy ID""" + + member_ids: List[str] + r"""Organization member user IDs""" + + name: str + r"""Policy name""" + + opted_out_api_key_hashes: List[str] + r"""API key hashes""" + + overridden_api_key_hashes: List[str] + r"""API keys that have a different policy of this type assigned directly""" + + policy_type: BudgetGuardrailPolicyDetailPolicyType + + updated_at: Nullable[str] + + is_workspace_default: Optional[bool] = None + + opted_out_member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + overridden_member_ids: Optional[List[str]] = None + r"""Members that have a different policy of this type assigned directly""" + + reference: OptionalNullable[BudgetGuardrailPolicyDetailReference] = None + r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + + replaces_legacy_default: Optional[bool] = None + r"""Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "is_workspace_default", + "opted_out_member_ids", + "overridden_member_ids", + "reference", + "replaces_legacy_default", + ] + ) + nullable_fields = set(["reference", "updated_at"]) + null_default_fields = set(["reference"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/budgetguardrailpolicydetailresponse.py b/src/openrouter/components/budgetguardrailpolicydetailresponse.py new file mode 100644 index 000000000..f6c79b45f --- /dev/null +++ b/src/openrouter/components/budgetguardrailpolicydetailresponse.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .budgetguardrailpolicydetail import ( + BudgetGuardrailPolicyDetail, + BudgetGuardrailPolicyDetailTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class BudgetGuardrailPolicyDetailResponseTypedDict(TypedDict): + data: BudgetGuardrailPolicyDetailTypedDict + + +class BudgetGuardrailPolicyDetailResponse(BaseModel): + data: BudgetGuardrailPolicyDetail diff --git a/src/openrouter/components/budgetguardrailpolicyresponse.py b/src/openrouter/components/budgetguardrailpolicyresponse.py new file mode 100644 index 000000000..36d61a64b --- /dev/null +++ b/src/openrouter/components/budgetguardrailpolicyresponse.py @@ -0,0 +1,14 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .budgetguardrailpolicy import BudgetGuardrailPolicy, BudgetGuardrailPolicyTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class BudgetGuardrailPolicyResponseTypedDict(TypedDict): + data: BudgetGuardrailPolicyTypedDict + + +class BudgetGuardrailPolicyResponse(BaseModel): + data: BudgetGuardrailPolicy diff --git a/src/openrouter/components/budgetguardrailpolicysummary.py b/src/openrouter/components/budgetguardrailpolicysummary.py new file mode 100644 index 000000000..c6867d590 --- /dev/null +++ b/src/openrouter/components/budgetguardrailpolicysummary.py @@ -0,0 +1,94 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailbudgetpolicyconfig import ( + GuardrailBudgetPolicyConfig, + GuardrailBudgetPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +BudgetGuardrailPolicySummaryPolicyType = Literal["budget",] + + +class BudgetGuardrailPolicySummaryTypedDict(TypedDict): + api_key_count: int + config: GuardrailBudgetPolicyConfigTypedDict + id: str + r"""Policy ID""" + member_count: int + name: str + r"""Policy name""" + policy_type: BudgetGuardrailPolicySummaryPolicyType + updated_at: Nullable[str] + is_legacy_mapped: NotRequired[bool] + r"""Whether the policy is kept in sync with a v1 guardrail""" + is_workspace_default: NotRequired[bool] + legacy_guardrail_ids: NotRequired[List[str]] + r"""IDs of the v1 guardrails this policy was migrated from""" + replaced_legacy_guardrail_ids: NotRequired[List[str]] + r"""IDs of the v1 guardrails this policy replaced""" + + +class BudgetGuardrailPolicySummary(BaseModel): + api_key_count: int + + config: GuardrailBudgetPolicyConfig + + id: str + r"""Policy ID""" + + member_count: int + + name: str + r"""Policy name""" + + policy_type: BudgetGuardrailPolicySummaryPolicyType + + updated_at: Nullable[str] + + is_legacy_mapped: Optional[bool] = None + r"""Whether the policy is kept in sync with a v1 guardrail""" + + is_workspace_default: Optional[bool] = None + + legacy_guardrail_ids: Optional[List[str]] = None + r"""IDs of the v1 guardrails this policy was migrated from""" + + replaced_legacy_guardrail_ids: Optional[List[str]] = None + r"""IDs of the v1 guardrails this policy replaced""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "is_legacy_mapped", + "is_workspace_default", + "legacy_guardrail_ids", + "replaced_legacy_guardrail_ids", + ] + ) + nullable_fields = set(["updated_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/changeguardrailpolicyassignmentrequest.py b/src/openrouter/components/changeguardrailpolicyassignmentrequest.py new file mode 100644 index 000000000..27381f637 --- /dev/null +++ b/src/openrouter/components/changeguardrailpolicyassignmentrequest.py @@ -0,0 +1,50 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailpolicyassignmentstate import ( + GuardrailPolicyAssignmentState, + GuardrailPolicyAssignmentStateTypedDict, +) +from openrouter.types import BaseModel, UnrecognizedStr +from typing import Literal, Union +from typing_extensions import TypedDict + + +ChangeGuardrailPolicyAssignmentRequestPolicyType = Union[ + Literal[ + "budget", + "model_availability", + "moderation", + "rate_limit", + ], + UnrecognizedStr, +] +r"""Policy type the assignment is read or changed for""" + + +class ChangeGuardrailPolicyAssignmentRequestTypedDict(TypedDict): + assigned: bool + r"""`true` assigns the policy to the subject, `false` removes it""" + expected_assignment: GuardrailPolicyAssignmentStateTypedDict + policy_id: str + r"""Policy ID""" + policy_type: ChangeGuardrailPolicyAssignmentRequestPolicyType + r"""Policy type the assignment is read or changed for""" + workspace_id: str + r"""Workspace the policy belongs to""" + + +class ChangeGuardrailPolicyAssignmentRequest(BaseModel): + assigned: bool + r"""`true` assigns the policy to the subject, `false` removes it""" + + expected_assignment: GuardrailPolicyAssignmentState + + policy_id: str + r"""Policy ID""" + + policy_type: ChangeGuardrailPolicyAssignmentRequestPolicyType + r"""Policy type the assignment is read or changed for""" + + workspace_id: str + r"""Workspace the policy belongs to""" diff --git a/src/openrouter/components/changeguardrailpolicyassignmentresponse.py b/src/openrouter/components/changeguardrailpolicyassignmentresponse.py new file mode 100644 index 000000000..bb4e21fc4 --- /dev/null +++ b/src/openrouter/components/changeguardrailpolicyassignmentresponse.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ChangeGuardrailPolicyAssignmentResponseTypedDict(TypedDict): + data: bool + r"""Whether the assignment changed""" + + +class ChangeGuardrailPolicyAssignmentResponse(BaseModel): + data: bool + r"""Whether the assignment changed""" diff --git a/src/openrouter/components/createbudgetguardrailpolicyrequest.py b/src/openrouter/components/createbudgetguardrailpolicyrequest.py new file mode 100644 index 000000000..57c04236f --- /dev/null +++ b/src/openrouter/components/createbudgetguardrailpolicyrequest.py @@ -0,0 +1,84 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailbudgetpolicyauthoringconfig import ( + GuardrailBudgetPolicyAuthoringConfig, + GuardrailBudgetPolicyAuthoringConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +CreateBudgetGuardrailPolicyRequestPolicyType = Literal["budget",] + + +class CreateBudgetGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailBudgetPolicyAuthoringConfigTypedDict + name: str + r"""Policy name""" + policy_type: CreateBudgetGuardrailPolicyRequestPolicyType + workspace_id: str + r"""Workspace the policy belongs to""" + api_key_hashes: NotRequired[List[str]] + r"""API key hashes""" + is_workspace_default: NotRequired[bool] + r"""Make this the workspace default for its policy type. Defaults to `false`.""" + member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + opted_out_api_key_hashes: NotRequired[List[str]] + r"""API keys that should not inherit the policy when it is the workspace default""" + opted_out_member_ids: NotRequired[List[str]] + r"""Members that should not inherit the policy when it is the workspace default""" + + +class CreateBudgetGuardrailPolicyRequest(BaseModel): + config: GuardrailBudgetPolicyAuthoringConfig + + name: str + r"""Policy name""" + + policy_type: CreateBudgetGuardrailPolicyRequestPolicyType + + workspace_id: str + r"""Workspace the policy belongs to""" + + api_key_hashes: Optional[List[str]] = None + r"""API key hashes""" + + is_workspace_default: Optional[bool] = None + r"""Make this the workspace default for its policy type. Defaults to `false`.""" + + member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + opted_out_api_key_hashes: Optional[List[str]] = None + r"""API keys that should not inherit the policy when it is the workspace default""" + + opted_out_member_ids: Optional[List[str]] = None + r"""Members that should not inherit the policy when it is the workspace default""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "api_key_hashes", + "is_workspace_default", + "member_ids", + "opted_out_api_key_hashes", + "opted_out_member_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/createmodelavailabilityguardrailpolicyrequest.py b/src/openrouter/components/createmodelavailabilityguardrailpolicyrequest.py new file mode 100644 index 000000000..a5935ebd0 --- /dev/null +++ b/src/openrouter/components/createmodelavailabilityguardrailpolicyrequest.py @@ -0,0 +1,84 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmodelavailabilitypolicyauthoringconfig import ( + GuardrailModelAvailabilityPolicyAuthoringConfig, + GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +CreateModelAvailabilityGuardrailPolicyRequestPolicyType = Literal["model_availability",] + + +class CreateModelAvailabilityGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict + name: str + r"""Policy name""" + policy_type: CreateModelAvailabilityGuardrailPolicyRequestPolicyType + workspace_id: str + r"""Workspace the policy belongs to""" + api_key_hashes: NotRequired[List[str]] + r"""API key hashes""" + is_workspace_default: NotRequired[bool] + r"""Make this the workspace default for its policy type. Defaults to `false`.""" + member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + opted_out_api_key_hashes: NotRequired[List[str]] + r"""API keys that should not inherit the policy when it is the workspace default""" + opted_out_member_ids: NotRequired[List[str]] + r"""Members that should not inherit the policy when it is the workspace default""" + + +class CreateModelAvailabilityGuardrailPolicyRequest(BaseModel): + config: GuardrailModelAvailabilityPolicyAuthoringConfig + + name: str + r"""Policy name""" + + policy_type: CreateModelAvailabilityGuardrailPolicyRequestPolicyType + + workspace_id: str + r"""Workspace the policy belongs to""" + + api_key_hashes: Optional[List[str]] = None + r"""API key hashes""" + + is_workspace_default: Optional[bool] = None + r"""Make this the workspace default for its policy type. Defaults to `false`.""" + + member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + opted_out_api_key_hashes: Optional[List[str]] = None + r"""API keys that should not inherit the policy when it is the workspace default""" + + opted_out_member_ids: Optional[List[str]] = None + r"""Members that should not inherit the policy when it is the workspace default""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "api_key_hashes", + "is_workspace_default", + "member_ids", + "opted_out_api_key_hashes", + "opted_out_member_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/createmoderationguardrailpolicyrequest.py b/src/openrouter/components/createmoderationguardrailpolicyrequest.py new file mode 100644 index 000000000..0266b86d7 --- /dev/null +++ b/src/openrouter/components/createmoderationguardrailpolicyrequest.py @@ -0,0 +1,84 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmoderationpolicyconfig import ( + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +CreateModerationGuardrailPolicyRequestPolicyType = Literal["moderation",] + + +class CreateModerationGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailModerationPolicyConfigTypedDict + name: str + r"""Policy name""" + policy_type: CreateModerationGuardrailPolicyRequestPolicyType + workspace_id: str + r"""Workspace the policy belongs to""" + api_key_hashes: NotRequired[List[str]] + r"""API key hashes""" + is_workspace_default: NotRequired[bool] + r"""Make this the workspace default for its policy type. Defaults to `false`.""" + member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + opted_out_api_key_hashes: NotRequired[List[str]] + r"""API keys that should not inherit the policy when it is the workspace default""" + opted_out_member_ids: NotRequired[List[str]] + r"""Members that should not inherit the policy when it is the workspace default""" + + +class CreateModerationGuardrailPolicyRequest(BaseModel): + config: GuardrailModerationPolicyConfig + + name: str + r"""Policy name""" + + policy_type: CreateModerationGuardrailPolicyRequestPolicyType + + workspace_id: str + r"""Workspace the policy belongs to""" + + api_key_hashes: Optional[List[str]] = None + r"""API key hashes""" + + is_workspace_default: Optional[bool] = None + r"""Make this the workspace default for its policy type. Defaults to `false`.""" + + member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + opted_out_api_key_hashes: Optional[List[str]] = None + r"""API keys that should not inherit the policy when it is the workspace default""" + + opted_out_member_ids: Optional[List[str]] = None + r"""Members that should not inherit the policy when it is the workspace default""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "api_key_hashes", + "is_workspace_default", + "member_ids", + "opted_out_api_key_hashes", + "opted_out_member_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/deleteguardrailpolicyresponse.py b/src/openrouter/components/deleteguardrailpolicyresponse.py new file mode 100644 index 000000000..3a3f76019 --- /dev/null +++ b/src/openrouter/components/deleteguardrailpolicyresponse.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class DeleteGuardrailPolicyResponseTypedDict(TypedDict): + data: bool + r"""Whether the policy was deleted""" + + +class DeleteGuardrailPolicyResponse(BaseModel): + data: bool + r"""Whether the policy was deleted""" diff --git a/src/openrouter/components/guardrailbudgetpolicyauthoringconfig.py b/src/openrouter/components/guardrailbudgetpolicyauthoringconfig.py new file mode 100644 index 000000000..2337e2fe0 --- /dev/null +++ b/src/openrouter/components/guardrailbudgetpolicyauthoringconfig.py @@ -0,0 +1,45 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import Literal, Union +from typing_extensions import TypedDict + + +GuardrailBudgetPolicyAuthoringConfigResetInterval = Union[ + Literal[ + "daily", + "weekly", + "monthly", + ], + UnrecognizedStr, +] + + +class GuardrailBudgetPolicyAuthoringConfigTypedDict(TypedDict): + include_byok_in_budgets: bool + limit_usd: Nullable[float] + reset_interval: Nullable[GuardrailBudgetPolicyAuthoringConfigResetInterval] + + +class GuardrailBudgetPolicyAuthoringConfig(BaseModel): + include_byok_in_budgets: bool + + limit_usd: Nullable[float] + + reset_interval: Nullable[GuardrailBudgetPolicyAuthoringConfigResetInterval] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/guardrailbudgetpolicyconfig.py b/src/openrouter/components/guardrailbudgetpolicyconfig.py new file mode 100644 index 000000000..d7904915e --- /dev/null +++ b/src/openrouter/components/guardrailbudgetpolicyconfig.py @@ -0,0 +1,61 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailinterval import GuardrailInterval +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class GuardrailBudgetPolicyConfigTypedDict(TypedDict): + include_byok_in_budgets: NotRequired[bool] + r"""Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false.""" + limit_usd: NotRequired[Nullable[float]] + r"""Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400.""" + reset_interval: NotRequired[Nullable[GuardrailInterval]] + r"""Interval at which the limit resets (daily, weekly, monthly)""" + + +class GuardrailBudgetPolicyConfig(BaseModel): + include_byok_in_budgets: Optional[bool] = None + r"""Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false.""" + + limit_usd: OptionalNullable[float] = UNSET + r"""Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400.""" + + reset_interval: OptionalNullable[GuardrailInterval] = UNSET + r"""Interval at which the limit resets (daily, weekly, monthly)""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["include_byok_in_budgets", "limit_usd", "reset_interval"] + ) + nullable_fields = set(["limit_usd", "reset_interval"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py b/src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py new file mode 100644 index 000000000..55d1ed146 --- /dev/null +++ b/src/openrouter/components/guardrailmodelavailabilitypolicyauthoringconfig.py @@ -0,0 +1,154 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import List +from typing_extensions import NotRequired, TypedDict + + +class GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict(TypedDict): + allow_safety_retention_google: NotRequired[Nullable[bool]] + allow_safety_retention_other: NotRequired[Nullable[bool]] + allowed_data_regions: NotRequired[Nullable[List[str]]] + allowed_models: NotRequired[Nullable[List[str]]] + allowed_providers: NotRequired[Nullable[List[str]]] + enable_free_model_publication: NotRequired[Nullable[bool]] + enable_free_model_training: NotRequired[Nullable[bool]] + enable_paid_model_training: NotRequired[Nullable[bool]] + enforce_first_party_harness_models: NotRequired[Nullable[bool]] + enforce_zdr: NotRequired[Nullable[bool]] + enforce_zdr_anthropic: NotRequired[Nullable[bool]] + enforce_zdr_google: NotRequired[Nullable[bool]] + enforce_zdr_openai: NotRequired[Nullable[bool]] + enforce_zdr_other: NotRequired[Nullable[bool]] + enforce_zdr_xai: NotRequired[Nullable[bool]] + ignored_models: NotRequired[Nullable[List[str]]] + ignored_providers: NotRequired[Nullable[List[str]]] + platform_banned_authors: NotRequired[Nullable[List[str]]] + platform_banned_models: NotRequired[Nullable[List[str]]] + platform_banned_providers: NotRequired[Nullable[List[str]]] + require_eu_data_region: NotRequired[Nullable[bool]] + + +class GuardrailModelAvailabilityPolicyAuthoringConfig(BaseModel): + allow_safety_retention_google: OptionalNullable[bool] = UNSET + + allow_safety_retention_other: OptionalNullable[bool] = UNSET + + allowed_data_regions: OptionalNullable[List[str]] = UNSET + + allowed_models: OptionalNullable[List[str]] = UNSET + + allowed_providers: OptionalNullable[List[str]] = UNSET + + enable_free_model_publication: OptionalNullable[bool] = UNSET + + enable_free_model_training: OptionalNullable[bool] = UNSET + + enable_paid_model_training: OptionalNullable[bool] = UNSET + + enforce_first_party_harness_models: OptionalNullable[bool] = UNSET + + enforce_zdr: OptionalNullable[bool] = UNSET + + enforce_zdr_anthropic: OptionalNullable[bool] = UNSET + + enforce_zdr_google: OptionalNullable[bool] = UNSET + + enforce_zdr_openai: OptionalNullable[bool] = UNSET + + enforce_zdr_other: OptionalNullable[bool] = UNSET + + enforce_zdr_xai: OptionalNullable[bool] = UNSET + + ignored_models: OptionalNullable[List[str]] = UNSET + + ignored_providers: OptionalNullable[List[str]] = UNSET + + platform_banned_authors: OptionalNullable[List[str]] = UNSET + + platform_banned_models: OptionalNullable[List[str]] = UNSET + + platform_banned_providers: OptionalNullable[List[str]] = UNSET + + require_eu_data_region: OptionalNullable[bool] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "allow_safety_retention_google", + "allow_safety_retention_other", + "allowed_data_regions", + "allowed_models", + "allowed_providers", + "enable_free_model_publication", + "enable_free_model_training", + "enable_paid_model_training", + "enforce_first_party_harness_models", + "enforce_zdr", + "enforce_zdr_anthropic", + "enforce_zdr_google", + "enforce_zdr_openai", + "enforce_zdr_other", + "enforce_zdr_xai", + "ignored_models", + "ignored_providers", + "platform_banned_authors", + "platform_banned_models", + "platform_banned_providers", + "require_eu_data_region", + ] + ) + nullable_fields = set( + [ + "allow_safety_retention_google", + "allow_safety_retention_other", + "allowed_data_regions", + "allowed_models", + "allowed_providers", + "enable_free_model_publication", + "enable_free_model_training", + "enable_paid_model_training", + "enforce_first_party_harness_models", + "enforce_zdr", + "enforce_zdr_anthropic", + "enforce_zdr_google", + "enforce_zdr_openai", + "enforce_zdr_other", + "enforce_zdr_xai", + "ignored_models", + "ignored_providers", + "platform_banned_authors", + "platform_banned_models", + "platform_banned_providers", + "require_eu_data_region", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py b/src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py new file mode 100644 index 000000000..cb19bac25 --- /dev/null +++ b/src/openrouter/components/guardrailmodelavailabilitypolicyconfig.py @@ -0,0 +1,154 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import List +from typing_extensions import NotRequired, TypedDict + + +class GuardrailModelAvailabilityPolicyConfigTypedDict(TypedDict): + allow_safety_retention_google: NotRequired[Nullable[bool]] + allow_safety_retention_other: NotRequired[Nullable[bool]] + allowed_data_regions: NotRequired[Nullable[List[str]]] + allowed_models: NotRequired[Nullable[List[str]]] + allowed_providers: NotRequired[Nullable[List[str]]] + enable_free_model_publication: NotRequired[Nullable[bool]] + enable_free_model_training: NotRequired[Nullable[bool]] + enable_paid_model_training: NotRequired[Nullable[bool]] + enforce_first_party_harness_models: NotRequired[Nullable[bool]] + enforce_zdr: NotRequired[Nullable[bool]] + enforce_zdr_anthropic: NotRequired[Nullable[bool]] + enforce_zdr_google: NotRequired[Nullable[bool]] + enforce_zdr_openai: NotRequired[Nullable[bool]] + enforce_zdr_other: NotRequired[Nullable[bool]] + enforce_zdr_xai: NotRequired[Nullable[bool]] + ignored_models: NotRequired[Nullable[List[str]]] + ignored_providers: NotRequired[Nullable[List[str]]] + platform_banned_authors: NotRequired[Nullable[List[str]]] + platform_banned_models: NotRequired[Nullable[List[str]]] + platform_banned_providers: NotRequired[Nullable[List[str]]] + require_eu_data_region: NotRequired[Nullable[bool]] + + +class GuardrailModelAvailabilityPolicyConfig(BaseModel): + allow_safety_retention_google: OptionalNullable[bool] = UNSET + + allow_safety_retention_other: OptionalNullable[bool] = UNSET + + allowed_data_regions: OptionalNullable[List[str]] = UNSET + + allowed_models: OptionalNullable[List[str]] = UNSET + + allowed_providers: OptionalNullable[List[str]] = UNSET + + enable_free_model_publication: OptionalNullable[bool] = UNSET + + enable_free_model_training: OptionalNullable[bool] = UNSET + + enable_paid_model_training: OptionalNullable[bool] = UNSET + + enforce_first_party_harness_models: OptionalNullable[bool] = UNSET + + enforce_zdr: OptionalNullable[bool] = UNSET + + enforce_zdr_anthropic: OptionalNullable[bool] = UNSET + + enforce_zdr_google: OptionalNullable[bool] = UNSET + + enforce_zdr_openai: OptionalNullable[bool] = UNSET + + enforce_zdr_other: OptionalNullable[bool] = UNSET + + enforce_zdr_xai: OptionalNullable[bool] = UNSET + + ignored_models: OptionalNullable[List[str]] = UNSET + + ignored_providers: OptionalNullable[List[str]] = UNSET + + platform_banned_authors: OptionalNullable[List[str]] = UNSET + + platform_banned_models: OptionalNullable[List[str]] = UNSET + + platform_banned_providers: OptionalNullable[List[str]] = UNSET + + require_eu_data_region: OptionalNullable[bool] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "allow_safety_retention_google", + "allow_safety_retention_other", + "allowed_data_regions", + "allowed_models", + "allowed_providers", + "enable_free_model_publication", + "enable_free_model_training", + "enable_paid_model_training", + "enforce_first_party_harness_models", + "enforce_zdr", + "enforce_zdr_anthropic", + "enforce_zdr_google", + "enforce_zdr_openai", + "enforce_zdr_other", + "enforce_zdr_xai", + "ignored_models", + "ignored_providers", + "platform_banned_authors", + "platform_banned_models", + "platform_banned_providers", + "require_eu_data_region", + ] + ) + nullable_fields = set( + [ + "allow_safety_retention_google", + "allow_safety_retention_other", + "allowed_data_regions", + "allowed_models", + "allowed_providers", + "enable_free_model_publication", + "enable_free_model_training", + "enable_paid_model_training", + "enforce_first_party_harness_models", + "enforce_zdr", + "enforce_zdr_anthropic", + "enforce_zdr_google", + "enforce_zdr_openai", + "enforce_zdr_other", + "enforce_zdr_xai", + "ignored_models", + "ignored_providers", + "platform_banned_authors", + "platform_banned_models", + "platform_banned_providers", + "require_eu_data_region", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/guardrailmoderationpolicyconfig.py b/src/openrouter/components/guardrailmoderationpolicyconfig.py new file mode 100644 index 000000000..314926146 --- /dev/null +++ b/src/openrouter/components/guardrailmoderationpolicyconfig.py @@ -0,0 +1,374 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .armorcontext import ArmorContext, ArmorContextTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict + + +GuardrailModerationPolicyConfigMode = Union[ + Literal[ + "enforce", + "audit", + ], + UnrecognizedStr, +] +r"""`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.""" + + +GuardrailModerationPolicyConfigOnError = Union[ + Literal[ + "log", + "block", + ], + UnrecognizedStr, +] +r"""When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.""" + + +class ArmorTypedDict(TypedDict): + classifier_context: NotRequired[ArmorContextTypedDict] + r"""The Armor context: Claude Code's `classifier_context` (v1), with `auto_mode.{hard_deny,soft_deny,allow}` rules as strings or `{ id, instructions, threshold? }` objects and `auto_mode.environment` entries as `\"Name: value\"` strings or `{ name, value }` objects. `threshold` applies when Armor evaluates; when the provider evaluates natively (Anthropic dangerous-tool-use beta) rules are judged at the provider's own boundary.""" + mode: NotRequired[GuardrailModerationPolicyConfigMode] + r"""`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.""" + on_error: NotRequired[GuardrailModerationPolicyConfigOnError] + r"""When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.""" + use_cc_style_default_rules: NotRequired[bool] + r"""Prepend Claude Code's built-in auto-mode rule set (1 hard-deny, 72 soft-deny, 17 allow, 21 environment slots) ahead of every configured rule. Defaults to true on the Anthropic Messages API and false elsewhere.""" + + +class Armor(BaseModel): + classifier_context: Optional[ArmorContext] = None + r"""The Armor context: Claude Code's `classifier_context` (v1), with `auto_mode.{hard_deny,soft_deny,allow}` rules as strings or `{ id, instructions, threshold? }` objects and `auto_mode.environment` entries as `\"Name: value\"` strings or `{ name, value }` objects. `threshold` applies when Armor evaluates; when the provider evaluates natively (Anthropic dangerous-tool-use beta) rules are judged at the provider's own boundary.""" + + mode: Optional[GuardrailModerationPolicyConfigMode] = None + r"""`enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.""" + + on_error: Optional[GuardrailModerationPolicyConfigOnError] = None + r"""When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.""" + + use_cc_style_default_rules: Optional[bool] = None + r"""Prepend Claude Code's built-in auto-mode rule set (1 hard-deny, 72 soft-deny, 17 allow, 21 environment slots) ahead of every configured rule. Defaults to true on the Anthropic Messages API and false elsewhere.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["classifier_context", "mode", "on_error", "use_cc_style_default_rules"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GuardrailModerationPolicyConfigContentFilterBuiltinAction = Union[ + Literal[ + "redact", + "block", + "flag", + ], + UnrecognizedStr, +] + + +ScanScope = Union[ + Literal[ + "user_only", + "all_messages", + ], + UnrecognizedStr, +] + + +Slug = Union[ + Literal[ + "email", + "phone", + "ssn", + "credit-card", + "ip-address", + "secrets", + "person-name", + "address", + "regex-prompt-injection", + ], + UnrecognizedStr, +] + + +class ContentFilterBuiltinTypedDict(TypedDict): + action: GuardrailModerationPolicyConfigContentFilterBuiltinAction + slug: Slug + label: NotRequired[str] + scan_scope: NotRequired[ScanScope] + + +class ContentFilterBuiltin(BaseModel): + action: GuardrailModerationPolicyConfigContentFilterBuiltinAction + + slug: Slug + + label: Optional[str] = None + + scan_scope: Optional[ScanScope] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["label", "scan_scope"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GuardrailModerationPolicyConfigContentFilterAction = Union[ + Literal[ + "redact", + "block", + "flag", + ], + UnrecognizedStr, +] + + +class ContentFilterTypedDict(TypedDict): + action: GuardrailModerationPolicyConfigContentFilterAction + pattern: str + label: NotRequired[Nullable[str]] + + +class ContentFilter(BaseModel): + action: GuardrailModerationPolicyConfigContentFilterAction + + pattern: str + + label: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["label"]) + nullable_fields = set(["label"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +LakeraInjectionProtectionMode = Union[ + Literal[ + "block", + "flag", + ], + UnrecognizedStr, +] + + +ModelArmorInjectionConfidenceLevel = Union[ + Literal[ + "low", + "medium", + "high", + ], + UnrecognizedStr, +] + + +ModelArmorInjectionProtectionMode = Union[ + Literal[ + "block", + "flag", + ], + UnrecognizedStr, +] + + +PiiFilterAction = Union[ + Literal[ + "redact", + "block", + "flag", + ], + UnrecognizedStr, +] + + +class PiiFilterTypedDict(TypedDict): + action: PiiFilterAction + entity_type: str + score_threshold: NotRequired[float] + + +class PiiFilter(BaseModel): + action: PiiFilterAction + + entity_type: str + + score_threshold: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["score_threshold"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GuardrailModerationPolicyConfigTypedDict(TypedDict): + armor: NotRequired[Nullable[ArmorTypedDict]] + broadcast_model_armor_flagged_requests: NotRequired[Nullable[bool]] + content_filter_blocks_requests: NotRequired[bool] + content_filter_builtins: NotRequired[Nullable[List[ContentFilterBuiltinTypedDict]]] + content_filter_patterns: NotRequired[Nullable[List[str]]] + content_filters: NotRequired[Nullable[List[ContentFilterTypedDict]]] + enable_model_armor_injection_protection: NotRequired[Nullable[bool]] + lakera_injection_protection_mode: NotRequired[ + Nullable[LakeraInjectionProtectionMode] + ] + model_armor_injection_confidence_level: NotRequired[ + ModelArmorInjectionConfidenceLevel + ] + model_armor_injection_protection_mode: NotRequired[ + Nullable[ModelArmorInjectionProtectionMode] + ] + pii_filters: NotRequired[Nullable[List[PiiFilterTypedDict]]] + platform_image_moderated_providers: NotRequired[Nullable[List[str]]] + platform_moderated_providers: NotRequired[Nullable[List[str]]] + + +class GuardrailModerationPolicyConfig(BaseModel): + armor: OptionalNullable[Armor] = UNSET + + broadcast_model_armor_flagged_requests: OptionalNullable[bool] = UNSET + + content_filter_blocks_requests: Optional[bool] = None + + content_filter_builtins: OptionalNullable[List[ContentFilterBuiltin]] = UNSET + + content_filter_patterns: OptionalNullable[List[str]] = UNSET + + content_filters: OptionalNullable[List[ContentFilter]] = UNSET + + enable_model_armor_injection_protection: OptionalNullable[bool] = UNSET + + lakera_injection_protection_mode: OptionalNullable[ + LakeraInjectionProtectionMode + ] = UNSET + + model_armor_injection_confidence_level: Optional[ + ModelArmorInjectionConfidenceLevel + ] = None + + model_armor_injection_protection_mode: OptionalNullable[ + ModelArmorInjectionProtectionMode + ] = UNSET + + pii_filters: OptionalNullable[List[PiiFilter]] = UNSET + + platform_image_moderated_providers: OptionalNullable[List[str]] = UNSET + + platform_moderated_providers: OptionalNullable[List[str]] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "armor", + "broadcast_model_armor_flagged_requests", + "content_filter_blocks_requests", + "content_filter_builtins", + "content_filter_patterns", + "content_filters", + "enable_model_armor_injection_protection", + "lakera_injection_protection_mode", + "model_armor_injection_confidence_level", + "model_armor_injection_protection_mode", + "pii_filters", + "platform_image_moderated_providers", + "platform_moderated_providers", + ] + ) + nullable_fields = set( + [ + "armor", + "broadcast_model_armor_flagged_requests", + "content_filter_builtins", + "content_filter_patterns", + "content_filters", + "enable_model_armor_injection_protection", + "lakera_injection_protection_mode", + "model_armor_injection_protection_mode", + "pii_filters", + "platform_image_moderated_providers", + "platform_moderated_providers", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/guardrailpolicyassignmentresponse.py b/src/openrouter/components/guardrailpolicyassignmentresponse.py new file mode 100644 index 000000000..10c97f040 --- /dev/null +++ b/src/openrouter/components/guardrailpolicyassignmentresponse.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailpolicyassignmentstate import ( + GuardrailPolicyAssignmentState, + GuardrailPolicyAssignmentStateTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class GuardrailPolicyAssignmentResponseTypedDict(TypedDict): + data: GuardrailPolicyAssignmentStateTypedDict + + +class GuardrailPolicyAssignmentResponse(BaseModel): + data: GuardrailPolicyAssignmentState diff --git a/src/openrouter/components/guardrailpolicyassignmentstate.py b/src/openrouter/components/guardrailpolicyassignmentstate.py new file mode 100644 index 000000000..4b8ecd29e --- /dev/null +++ b/src/openrouter/components/guardrailpolicyassignmentstate.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class GuardrailPolicyAssignmentStateTypedDict(TypedDict): + opted_out: bool + r"""Whether the subject is opted out of the workspace default""" + policy_ids: List[str] + r"""Policies of this type assigned directly to the subject""" + workspace_default_policy_ids: List[str] + r"""Workspace default policies of this type the subject inherits""" + + +class GuardrailPolicyAssignmentState(BaseModel): + opted_out: bool + r"""Whether the subject is opted out of the workspace default""" + + policy_ids: List[str] + r"""Policies of this type assigned directly to the subject""" + + workspace_default_policy_ids: List[str] + r"""Workspace default policies of this type the subject inherits""" diff --git a/src/openrouter/components/listaccountguardrailpoliciesresponse.py b/src/openrouter/components/listaccountguardrailpoliciesresponse.py new file mode 100644 index 000000000..72b56dcf6 --- /dev/null +++ b/src/openrouter/components/listaccountguardrailpoliciesresponse.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .accountguardrailpolicy import ( + AccountGuardrailPolicy, + AccountGuardrailPolicyTypedDict, +) +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ListAccountGuardrailPoliciesResponseTypedDict(TypedDict): + data: List[AccountGuardrailPolicyTypedDict] + total_count: int + r"""Total number of policies""" + + +class ListAccountGuardrailPoliciesResponse(BaseModel): + data: List[AccountGuardrailPolicy] + + total_count: int + r"""Total number of policies""" diff --git a/src/openrouter/components/listbudgetguardrailpoliciesresponse.py b/src/openrouter/components/listbudgetguardrailpoliciesresponse.py new file mode 100644 index 000000000..305ff8281 --- /dev/null +++ b/src/openrouter/components/listbudgetguardrailpoliciesresponse.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .budgetguardrailpolicysummary import ( + BudgetGuardrailPolicySummary, + BudgetGuardrailPolicySummaryTypedDict, +) +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ListBudgetGuardrailPoliciesResponseTypedDict(TypedDict): + data: List[BudgetGuardrailPolicySummaryTypedDict] + total_count: int + r"""Total number of policies""" + + +class ListBudgetGuardrailPoliciesResponse(BaseModel): + data: List[BudgetGuardrailPolicySummary] + + total_count: int + r"""Total number of policies""" diff --git a/src/openrouter/components/listmodelavailabilityguardrailpoliciesresponse.py b/src/openrouter/components/listmodelavailabilityguardrailpoliciesresponse.py new file mode 100644 index 000000000..aeb2e0b4b --- /dev/null +++ b/src/openrouter/components/listmodelavailabilityguardrailpoliciesresponse.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .modelavailabilityguardrailpolicysummary import ( + ModelAvailabilityGuardrailPolicySummary, + ModelAvailabilityGuardrailPolicySummaryTypedDict, +) +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ListModelAvailabilityGuardrailPoliciesResponseTypedDict(TypedDict): + data: List[ModelAvailabilityGuardrailPolicySummaryTypedDict] + total_count: int + r"""Total number of policies""" + + +class ListModelAvailabilityGuardrailPoliciesResponse(BaseModel): + data: List[ModelAvailabilityGuardrailPolicySummary] + + total_count: int + r"""Total number of policies""" diff --git a/src/openrouter/components/listmoderationguardrailpoliciesresponse.py b/src/openrouter/components/listmoderationguardrailpoliciesresponse.py new file mode 100644 index 000000000..0c4a382ab --- /dev/null +++ b/src/openrouter/components/listmoderationguardrailpoliciesresponse.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .moderationguardrailpolicysummary import ( + ModerationGuardrailPolicySummary, + ModerationGuardrailPolicySummaryTypedDict, +) +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ListModerationGuardrailPoliciesResponseTypedDict(TypedDict): + data: List[ModerationGuardrailPolicySummaryTypedDict] + total_count: int + r"""Total number of policies""" + + +class ListModerationGuardrailPoliciesResponse(BaseModel): + data: List[ModerationGuardrailPolicySummary] + + total_count: int + r"""Total number of policies""" diff --git a/src/openrouter/components/modelavailabilityaccountguardrailpolicy.py b/src/openrouter/components/modelavailabilityaccountguardrailpolicy.py new file mode 100644 index 000000000..e0c22fdd7 --- /dev/null +++ b/src/openrouter/components/modelavailabilityaccountguardrailpolicy.py @@ -0,0 +1,77 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmodelavailabilitypolicyconfig import ( + GuardrailModelAvailabilityPolicyConfig, + GuardrailModelAvailabilityPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal +from typing_extensions import TypedDict + + +ModelAvailabilityAccountGuardrailPolicyPolicyType = Literal["model_availability",] + + +class ModelAvailabilityAccountGuardrailPolicyTypedDict(TypedDict): + config: GuardrailModelAvailabilityPolicyConfigTypedDict + created_at: str + id: str + r"""Policy ID""" + is_default: bool + is_synced: bool + r"""Kept in sync with a v1 guardrail; saving changes creates an account copy""" + is_workspace_default_synced: bool + r"""Synced from a v1 workspace default guardrail""" + name: str + r"""Policy name""" + opted_out_workspace_ids: List[str] + policy_type: ModelAvailabilityAccountGuardrailPolicyPolicyType + updated_at: Nullable[str] + workspace_count: int + workspace_ids: List[str] + + +class ModelAvailabilityAccountGuardrailPolicy(BaseModel): + config: GuardrailModelAvailabilityPolicyConfig + + created_at: str + + id: str + r"""Policy ID""" + + is_default: bool + + is_synced: bool + r"""Kept in sync with a v1 guardrail; saving changes creates an account copy""" + + is_workspace_default_synced: bool + r"""Synced from a v1 workspace default guardrail""" + + name: str + r"""Policy name""" + + opted_out_workspace_ids: List[str] + + policy_type: ModelAvailabilityAccountGuardrailPolicyPolicyType + + updated_at: Nullable[str] + + workspace_count: int + + workspace_ids: List[str] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/modelavailabilityaccountguardrailpolicyrequest.py b/src/openrouter/components/modelavailabilityaccountguardrailpolicyrequest.py new file mode 100644 index 000000000..b862e2670 --- /dev/null +++ b/src/openrouter/components/modelavailabilityaccountguardrailpolicyrequest.py @@ -0,0 +1,110 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmodelavailabilitypolicyauthoringconfig import ( + GuardrailModelAvailabilityPolicyAuthoringConfig, + GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +class ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignmentTypedDict( + TypedDict +): + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + policy_id: str + r"""Policy ID""" + workspace_ids: List[str] + + +class ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignment(BaseModel): + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + policy_id: str + r"""Policy ID""" + + workspace_ids: List[str] + + +ModelAvailabilityAccountGuardrailPolicyRequestPolicyType = Literal[ + "model_availability", +] + + +class ModelAvailabilityAccountGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict + name: str + r"""Policy name""" + policy_type: ModelAvailabilityAccountGuardrailPolicyRequestPolicyType + floor_reassignment: NotRequired[ + ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignmentTypedDict + ] + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + is_default: NotRequired[bool] + r"""Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.""" + keep_previous_default_workspaces: NotRequired[bool] + r"""Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.""" + opted_out_workspace_ids: NotRequired[List[str]] + r"""Workspaces left out of a default policy""" + released_floor_workspace_ids: NotRequired[List[str]] + r"""Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default""" + workspace_ids: NotRequired[List[str]] + r"""Workspaces the policy covers when it is not the default""" + + +class ModelAvailabilityAccountGuardrailPolicyRequest(BaseModel): + config: GuardrailModelAvailabilityPolicyAuthoringConfig + + name: str + r"""Policy name""" + + policy_type: ModelAvailabilityAccountGuardrailPolicyRequestPolicyType + + floor_reassignment: Optional[ + ModelAvailabilityAccountGuardrailPolicyRequestFloorReassignment + ] = None + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + is_default: Optional[bool] = None + r"""Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.""" + + keep_previous_default_workspaces: Optional[bool] = None + r"""Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.""" + + opted_out_workspace_ids: Optional[List[str]] = None + r"""Workspaces left out of a default policy""" + + released_floor_workspace_ids: Optional[List[str]] = None + r"""Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default""" + + workspace_ids: Optional[List[str]] = None + r"""Workspaces the policy covers when it is not the default""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "floor_reassignment", + "is_default", + "keep_previous_default_workspaces", + "opted_out_workspace_ids", + "released_floor_workspace_ids", + "workspace_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/modelavailabilityguardrailpolicy.py b/src/openrouter/components/modelavailabilityguardrailpolicy.py new file mode 100644 index 000000000..1f95f9bd0 --- /dev/null +++ b/src/openrouter/components/modelavailabilityguardrailpolicy.py @@ -0,0 +1,34 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmodelavailabilitypolicyconfig import ( + GuardrailModelAvailabilityPolicyConfig, + GuardrailModelAvailabilityPolicyConfigTypedDict, +) +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +ModelAvailabilityGuardrailPolicyPolicyType = Literal["model_availability",] + + +class ModelAvailabilityGuardrailPolicyTypedDict(TypedDict): + config: GuardrailModelAvailabilityPolicyConfigTypedDict + id: str + r"""Policy ID""" + name: str + r"""Policy name""" + policy_type: ModelAvailabilityGuardrailPolicyPolicyType + + +class ModelAvailabilityGuardrailPolicy(BaseModel): + config: GuardrailModelAvailabilityPolicyConfig + + id: str + r"""Policy ID""" + + name: str + r"""Policy name""" + + policy_type: ModelAvailabilityGuardrailPolicyPolicyType diff --git a/src/openrouter/components/modelavailabilityguardrailpolicydetail.py b/src/openrouter/components/modelavailabilityguardrailpolicydetail.py new file mode 100644 index 000000000..ceaf2f735 --- /dev/null +++ b/src/openrouter/components/modelavailabilityguardrailpolicydetail.py @@ -0,0 +1,134 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmodelavailabilitypolicyconfig import ( + GuardrailModelAvailabilityPolicyConfig, + GuardrailModelAvailabilityPolicyConfigTypedDict, +) +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET_SENTINEL, + UnrecognizedStr, +) +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict + + +ModelAvailabilityGuardrailPolicyDetailPolicyType = Literal["model_availability",] + + +ModelAvailabilityGuardrailPolicyDetailReference = Union[ + Literal[ + "legacy_mapping", + "account_default", + ], + UnrecognizedStr, +] +r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + + +class ModelAvailabilityGuardrailPolicyDetailTypedDict(TypedDict): + api_key_hashes: List[str] + r"""API key hashes""" + config: GuardrailModelAvailabilityPolicyConfigTypedDict + id: str + r"""Policy ID""" + member_ids: List[str] + r"""Organization member user IDs""" + name: str + r"""Policy name""" + opted_out_api_key_hashes: List[str] + r"""API key hashes""" + overridden_api_key_hashes: List[str] + r"""API keys that have a different policy of this type assigned directly""" + policy_type: ModelAvailabilityGuardrailPolicyDetailPolicyType + updated_at: Nullable[str] + is_workspace_default: NotRequired[bool] + opted_out_member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + overridden_member_ids: NotRequired[List[str]] + r"""Members that have a different policy of this type assigned directly""" + reference: NotRequired[Nullable[ModelAvailabilityGuardrailPolicyDetailReference]] + r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + replaces_legacy_default: NotRequired[bool] + r"""Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted""" + + +class ModelAvailabilityGuardrailPolicyDetail(BaseModel): + api_key_hashes: List[str] + r"""API key hashes""" + + config: GuardrailModelAvailabilityPolicyConfig + + id: str + r"""Policy ID""" + + member_ids: List[str] + r"""Organization member user IDs""" + + name: str + r"""Policy name""" + + opted_out_api_key_hashes: List[str] + r"""API key hashes""" + + overridden_api_key_hashes: List[str] + r"""API keys that have a different policy of this type assigned directly""" + + policy_type: ModelAvailabilityGuardrailPolicyDetailPolicyType + + updated_at: Nullable[str] + + is_workspace_default: Optional[bool] = None + + opted_out_member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + overridden_member_ids: Optional[List[str]] = None + r"""Members that have a different policy of this type assigned directly""" + + reference: OptionalNullable[ModelAvailabilityGuardrailPolicyDetailReference] = None + r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + + replaces_legacy_default: Optional[bool] = None + r"""Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "is_workspace_default", + "opted_out_member_ids", + "overridden_member_ids", + "reference", + "replaces_legacy_default", + ] + ) + nullable_fields = set(["reference", "updated_at"]) + null_default_fields = set(["reference"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/modelavailabilityguardrailpolicydetailresponse.py b/src/openrouter/components/modelavailabilityguardrailpolicydetailresponse.py new file mode 100644 index 000000000..0bbae3d3e --- /dev/null +++ b/src/openrouter/components/modelavailabilityguardrailpolicydetailresponse.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .modelavailabilityguardrailpolicydetail import ( + ModelAvailabilityGuardrailPolicyDetail, + ModelAvailabilityGuardrailPolicyDetailTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ModelAvailabilityGuardrailPolicyDetailResponseTypedDict(TypedDict): + data: ModelAvailabilityGuardrailPolicyDetailTypedDict + + +class ModelAvailabilityGuardrailPolicyDetailResponse(BaseModel): + data: ModelAvailabilityGuardrailPolicyDetail diff --git a/src/openrouter/components/modelavailabilityguardrailpolicyresponse.py b/src/openrouter/components/modelavailabilityguardrailpolicyresponse.py new file mode 100644 index 000000000..848445a16 --- /dev/null +++ b/src/openrouter/components/modelavailabilityguardrailpolicyresponse.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .modelavailabilityguardrailpolicy import ( + ModelAvailabilityGuardrailPolicy, + ModelAvailabilityGuardrailPolicyTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ModelAvailabilityGuardrailPolicyResponseTypedDict(TypedDict): + data: ModelAvailabilityGuardrailPolicyTypedDict + + +class ModelAvailabilityGuardrailPolicyResponse(BaseModel): + data: ModelAvailabilityGuardrailPolicy diff --git a/src/openrouter/components/modelavailabilityguardrailpolicysummary.py b/src/openrouter/components/modelavailabilityguardrailpolicysummary.py new file mode 100644 index 000000000..b711944d1 --- /dev/null +++ b/src/openrouter/components/modelavailabilityguardrailpolicysummary.py @@ -0,0 +1,94 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmodelavailabilitypolicyconfig import ( + GuardrailModelAvailabilityPolicyConfig, + GuardrailModelAvailabilityPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +ModelAvailabilityGuardrailPolicySummaryPolicyType = Literal["model_availability",] + + +class ModelAvailabilityGuardrailPolicySummaryTypedDict(TypedDict): + api_key_count: int + config: GuardrailModelAvailabilityPolicyConfigTypedDict + id: str + r"""Policy ID""" + member_count: int + name: str + r"""Policy name""" + policy_type: ModelAvailabilityGuardrailPolicySummaryPolicyType + updated_at: Nullable[str] + is_legacy_mapped: NotRequired[bool] + r"""Whether the policy is kept in sync with a v1 guardrail""" + is_workspace_default: NotRequired[bool] + legacy_guardrail_ids: NotRequired[List[str]] + r"""IDs of the v1 guardrails this policy was migrated from""" + replaced_legacy_guardrail_ids: NotRequired[List[str]] + r"""IDs of the v1 guardrails this policy replaced""" + + +class ModelAvailabilityGuardrailPolicySummary(BaseModel): + api_key_count: int + + config: GuardrailModelAvailabilityPolicyConfig + + id: str + r"""Policy ID""" + + member_count: int + + name: str + r"""Policy name""" + + policy_type: ModelAvailabilityGuardrailPolicySummaryPolicyType + + updated_at: Nullable[str] + + is_legacy_mapped: Optional[bool] = None + r"""Whether the policy is kept in sync with a v1 guardrail""" + + is_workspace_default: Optional[bool] = None + + legacy_guardrail_ids: Optional[List[str]] = None + r"""IDs of the v1 guardrails this policy was migrated from""" + + replaced_legacy_guardrail_ids: Optional[List[str]] = None + r"""IDs of the v1 guardrails this policy replaced""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "is_legacy_mapped", + "is_workspace_default", + "legacy_guardrail_ids", + "replaced_legacy_guardrail_ids", + ] + ) + nullable_fields = set(["updated_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/moderationaccountguardrailpolicy.py b/src/openrouter/components/moderationaccountguardrailpolicy.py new file mode 100644 index 000000000..7ad79ba04 --- /dev/null +++ b/src/openrouter/components/moderationaccountguardrailpolicy.py @@ -0,0 +1,77 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmoderationpolicyconfig import ( + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal +from typing_extensions import TypedDict + + +ModerationAccountGuardrailPolicyPolicyType = Literal["moderation",] + + +class ModerationAccountGuardrailPolicyTypedDict(TypedDict): + config: GuardrailModerationPolicyConfigTypedDict + created_at: str + id: str + r"""Policy ID""" + is_default: bool + is_synced: bool + r"""Kept in sync with a v1 guardrail; saving changes creates an account copy""" + is_workspace_default_synced: bool + r"""Synced from a v1 workspace default guardrail""" + name: str + r"""Policy name""" + opted_out_workspace_ids: List[str] + policy_type: ModerationAccountGuardrailPolicyPolicyType + updated_at: Nullable[str] + workspace_count: int + workspace_ids: List[str] + + +class ModerationAccountGuardrailPolicy(BaseModel): + config: GuardrailModerationPolicyConfig + + created_at: str + + id: str + r"""Policy ID""" + + is_default: bool + + is_synced: bool + r"""Kept in sync with a v1 guardrail; saving changes creates an account copy""" + + is_workspace_default_synced: bool + r"""Synced from a v1 workspace default guardrail""" + + name: str + r"""Policy name""" + + opted_out_workspace_ids: List[str] + + policy_type: ModerationAccountGuardrailPolicyPolicyType + + updated_at: Nullable[str] + + workspace_count: int + + workspace_ids: List[str] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/moderationaccountguardrailpolicyrequest.py b/src/openrouter/components/moderationaccountguardrailpolicyrequest.py new file mode 100644 index 000000000..49d6516ab --- /dev/null +++ b/src/openrouter/components/moderationaccountguardrailpolicyrequest.py @@ -0,0 +1,106 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmoderationpolicyconfig import ( + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +class ModerationAccountGuardrailPolicyRequestFloorReassignmentTypedDict(TypedDict): + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + policy_id: str + r"""Policy ID""" + workspace_ids: List[str] + + +class ModerationAccountGuardrailPolicyRequestFloorReassignment(BaseModel): + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + policy_id: str + r"""Policy ID""" + + workspace_ids: List[str] + + +ModerationAccountGuardrailPolicyRequestPolicyType = Literal["moderation",] + + +class ModerationAccountGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailModerationPolicyConfigTypedDict + name: str + r"""Policy name""" + policy_type: ModerationAccountGuardrailPolicyRequestPolicyType + floor_reassignment: NotRequired[ + ModerationAccountGuardrailPolicyRequestFloorReassignmentTypedDict + ] + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + is_default: NotRequired[bool] + r"""Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.""" + keep_previous_default_workspaces: NotRequired[bool] + r"""Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.""" + opted_out_workspace_ids: NotRequired[List[str]] + r"""Workspaces left out of a default policy""" + released_floor_workspace_ids: NotRequired[List[str]] + r"""Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default""" + workspace_ids: NotRequired[List[str]] + r"""Workspaces the policy covers when it is not the default""" + + +class ModerationAccountGuardrailPolicyRequest(BaseModel): + config: GuardrailModerationPolicyConfig + + name: str + r"""Policy name""" + + policy_type: ModerationAccountGuardrailPolicyRequestPolicyType + + floor_reassignment: Optional[ + ModerationAccountGuardrailPolicyRequestFloorReassignment + ] = None + r"""Move workspaces off this policy onto another workspace-wide policy in the same write""" + + is_default: Optional[bool] = None + r"""Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.""" + + keep_previous_default_workspaces: Optional[bool] = None + r"""Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.""" + + opted_out_workspace_ids: Optional[List[str]] = None + r"""Workspaces left out of a default policy""" + + released_floor_workspace_ids: Optional[List[str]] = None + r"""Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default""" + + workspace_ids: Optional[List[str]] = None + r"""Workspaces the policy covers when it is not the default""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "floor_reassignment", + "is_default", + "keep_previous_default_workspaces", + "opted_out_workspace_ids", + "released_floor_workspace_ids", + "workspace_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/moderationguardrailpolicy.py b/src/openrouter/components/moderationguardrailpolicy.py new file mode 100644 index 000000000..e62956570 --- /dev/null +++ b/src/openrouter/components/moderationguardrailpolicy.py @@ -0,0 +1,34 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmoderationpolicyconfig import ( + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigTypedDict, +) +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +ModerationGuardrailPolicyPolicyType = Literal["moderation",] + + +class ModerationGuardrailPolicyTypedDict(TypedDict): + config: GuardrailModerationPolicyConfigTypedDict + id: str + r"""Policy ID""" + name: str + r"""Policy name""" + policy_type: ModerationGuardrailPolicyPolicyType + + +class ModerationGuardrailPolicy(BaseModel): + config: GuardrailModerationPolicyConfig + + id: str + r"""Policy ID""" + + name: str + r"""Policy name""" + + policy_type: ModerationGuardrailPolicyPolicyType diff --git a/src/openrouter/components/moderationguardrailpolicydetail.py b/src/openrouter/components/moderationguardrailpolicydetail.py new file mode 100644 index 000000000..2a1b8b5ec --- /dev/null +++ b/src/openrouter/components/moderationguardrailpolicydetail.py @@ -0,0 +1,140 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmoderationpolicyconfig import ( + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigTypedDict, +) +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET_SENTINEL, + UnrecognizedStr, +) +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict + + +ModerationGuardrailPolicyDetailPolicyType = Literal["moderation",] + + +ModerationGuardrailPolicyDetailReference = Union[ + Literal[ + "legacy_mapping", + "account_default", + ], + UnrecognizedStr, +] +r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + + +class ModerationGuardrailPolicyDetailTypedDict(TypedDict): + api_key_hashes: List[str] + r"""API key hashes""" + config: GuardrailModerationPolicyConfigTypedDict + id: str + r"""Policy ID""" + member_ids: List[str] + r"""Organization member user IDs""" + name: str + r"""Policy name""" + opted_out_api_key_hashes: List[str] + r"""API key hashes""" + overridden_api_key_hashes: List[str] + r"""API keys that have a different policy of this type assigned directly""" + policy_type: ModerationGuardrailPolicyDetailPolicyType + updated_at: Nullable[str] + is_account_policy: NotRequired[bool] + r"""Whether this is an account-owned policy rather than a workspace policy""" + is_workspace_default: NotRequired[bool] + opted_out_member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + overridden_member_ids: NotRequired[List[str]] + r"""Members that have a different policy of this type assigned directly""" + reference: NotRequired[Nullable[ModerationGuardrailPolicyDetailReference]] + r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + replaces_legacy_default: NotRequired[bool] + r"""Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted""" + + +class ModerationGuardrailPolicyDetail(BaseModel): + api_key_hashes: List[str] + r"""API key hashes""" + + config: GuardrailModerationPolicyConfig + + id: str + r"""Policy ID""" + + member_ids: List[str] + r"""Organization member user IDs""" + + name: str + r"""Policy name""" + + opted_out_api_key_hashes: List[str] + r"""API key hashes""" + + overridden_api_key_hashes: List[str] + r"""API keys that have a different policy of this type assigned directly""" + + policy_type: ModerationGuardrailPolicyDetailPolicyType + + updated_at: Nullable[str] + + is_account_policy: Optional[bool] = None + r"""Whether this is an account-owned policy rather than a workspace policy""" + + is_workspace_default: Optional[bool] = None + + opted_out_member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + overridden_member_ids: Optional[List[str]] = None + r"""Members that have a different policy of this type assigned directly""" + + reference: OptionalNullable[ModerationGuardrailPolicyDetailReference] = None + r"""`legacy_mapping` when the policy is synced from a v1 guardrail, `account_default` when it is an account-wide default, otherwise `null`""" + + replaces_legacy_default: Optional[bool] = None + r"""Whether this workspace copy replaced a v1 workspace default guardrail that still exists; it cannot be deleted""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "is_account_policy", + "is_workspace_default", + "opted_out_member_ids", + "overridden_member_ids", + "reference", + "replaces_legacy_default", + ] + ) + nullable_fields = set(["reference", "updated_at"]) + null_default_fields = set(["reference"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/moderationguardrailpolicydetailresponse.py b/src/openrouter/components/moderationguardrailpolicydetailresponse.py new file mode 100644 index 000000000..48dc8f340 --- /dev/null +++ b/src/openrouter/components/moderationguardrailpolicydetailresponse.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .moderationguardrailpolicydetail import ( + ModerationGuardrailPolicyDetail, + ModerationGuardrailPolicyDetailTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ModerationGuardrailPolicyDetailResponseTypedDict(TypedDict): + data: ModerationGuardrailPolicyDetailTypedDict + + +class ModerationGuardrailPolicyDetailResponse(BaseModel): + data: ModerationGuardrailPolicyDetail diff --git a/src/openrouter/components/moderationguardrailpolicyresponse.py b/src/openrouter/components/moderationguardrailpolicyresponse.py new file mode 100644 index 000000000..391e85d16 --- /dev/null +++ b/src/openrouter/components/moderationguardrailpolicyresponse.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .moderationguardrailpolicy import ( + ModerationGuardrailPolicy, + ModerationGuardrailPolicyTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ModerationGuardrailPolicyResponseTypedDict(TypedDict): + data: ModerationGuardrailPolicyTypedDict + + +class ModerationGuardrailPolicyResponse(BaseModel): + data: ModerationGuardrailPolicy diff --git a/src/openrouter/components/moderationguardrailpolicysummary.py b/src/openrouter/components/moderationguardrailpolicysummary.py new file mode 100644 index 000000000..666cae305 --- /dev/null +++ b/src/openrouter/components/moderationguardrailpolicysummary.py @@ -0,0 +1,94 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmoderationpolicyconfig import ( + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +ModerationGuardrailPolicySummaryPolicyType = Literal["moderation",] + + +class ModerationGuardrailPolicySummaryTypedDict(TypedDict): + api_key_count: int + config: GuardrailModerationPolicyConfigTypedDict + id: str + r"""Policy ID""" + member_count: int + name: str + r"""Policy name""" + policy_type: ModerationGuardrailPolicySummaryPolicyType + updated_at: Nullable[str] + is_legacy_mapped: NotRequired[bool] + r"""Whether the policy is kept in sync with a v1 guardrail""" + is_workspace_default: NotRequired[bool] + legacy_guardrail_ids: NotRequired[List[str]] + r"""IDs of the v1 guardrails this policy was migrated from""" + replaced_legacy_guardrail_ids: NotRequired[List[str]] + r"""IDs of the v1 guardrails this policy replaced""" + + +class ModerationGuardrailPolicySummary(BaseModel): + api_key_count: int + + config: GuardrailModerationPolicyConfig + + id: str + r"""Policy ID""" + + member_count: int + + name: str + r"""Policy name""" + + policy_type: ModerationGuardrailPolicySummaryPolicyType + + updated_at: Nullable[str] + + is_legacy_mapped: Optional[bool] = None + r"""Whether the policy is kept in sync with a v1 guardrail""" + + is_workspace_default: Optional[bool] = None + + legacy_guardrail_ids: Optional[List[str]] = None + r"""IDs of the v1 guardrails this policy was migrated from""" + + replaced_legacy_guardrail_ids: Optional[List[str]] = None + r"""IDs of the v1 guardrails this policy replaced""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "is_legacy_mapped", + "is_workspace_default", + "legacy_guardrail_ids", + "replaced_legacy_guardrail_ids", + ] + ) + nullable_fields = set(["updated_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/components/outputmemoryservertoolitem.py b/src/openrouter/components/outputmemoryservertoolitem.py index 775551b0a..e542eaeab 100644 --- a/src/openrouter/components/outputmemoryservertoolitem.py +++ b/src/openrouter/components/outputmemoryservertoolitem.py @@ -8,7 +8,7 @@ from typing_extensions import NotRequired, TypedDict -ActionEnum = Union[ +OutputMemoryServerToolItemAction = Union[ Literal[ "read", "write", @@ -26,7 +26,7 @@ class OutputMemoryServerToolItemTypedDict(TypedDict): status: ToolCallStatus type: OutputMemoryServerToolItemType - action: NotRequired[ActionEnum] + action: NotRequired[OutputMemoryServerToolItemAction] id: NotRequired[str] key: NotRequired[str] value: NotRequired[Any] @@ -39,7 +39,7 @@ class OutputMemoryServerToolItem(BaseModel): type: OutputMemoryServerToolItemType - action: Optional[ActionEnum] = None + action: Optional[OutputMemoryServerToolItemAction] = None id: Optional[str] = None diff --git a/src/openrouter/components/updatebudgetguardrailpolicyrequest.py b/src/openrouter/components/updatebudgetguardrailpolicyrequest.py new file mode 100644 index 000000000..c85421a39 --- /dev/null +++ b/src/openrouter/components/updatebudgetguardrailpolicyrequest.py @@ -0,0 +1,78 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailbudgetpolicyauthoringconfig import ( + GuardrailBudgetPolicyAuthoringConfig, + GuardrailBudgetPolicyAuthoringConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class UpdateBudgetGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailBudgetPolicyAuthoringConfigTypedDict + name: str + r"""Policy name""" + workspace_id: str + r"""Workspace the policy belongs to""" + api_key_hashes: NotRequired[List[str]] + r"""Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.""" + is_workspace_default: NotRequired[bool] + r"""Omit to keep the stored default status; `false` unsets the policy as the workspace default.""" + member_ids: NotRequired[List[str]] + r"""Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.""" + opted_out_api_key_hashes: NotRequired[List[str]] + r"""API key hashes""" + opted_out_member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + + +class UpdateBudgetGuardrailPolicyRequest(BaseModel): + config: GuardrailBudgetPolicyAuthoringConfig + + name: str + r"""Policy name""" + + workspace_id: str + r"""Workspace the policy belongs to""" + + api_key_hashes: Optional[List[str]] = None + r"""Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.""" + + is_workspace_default: Optional[bool] = None + r"""Omit to keep the stored default status; `false` unsets the policy as the workspace default.""" + + member_ids: Optional[List[str]] = None + r"""Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.""" + + opted_out_api_key_hashes: Optional[List[str]] = None + r"""API key hashes""" + + opted_out_member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "api_key_hashes", + "is_workspace_default", + "member_ids", + "opted_out_api_key_hashes", + "opted_out_member_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/updatemodelavailabilityguardrailpolicyrequest.py b/src/openrouter/components/updatemodelavailabilityguardrailpolicyrequest.py new file mode 100644 index 000000000..761d47a3b --- /dev/null +++ b/src/openrouter/components/updatemodelavailabilityguardrailpolicyrequest.py @@ -0,0 +1,78 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmodelavailabilitypolicyauthoringconfig import ( + GuardrailModelAvailabilityPolicyAuthoringConfig, + GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class UpdateModelAvailabilityGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict + name: str + r"""Policy name""" + workspace_id: str + r"""Workspace the policy belongs to""" + api_key_hashes: NotRequired[List[str]] + r"""Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.""" + is_workspace_default: NotRequired[bool] + r"""Omit to keep the stored default status; `false` unsets the policy as the workspace default.""" + member_ids: NotRequired[List[str]] + r"""Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.""" + opted_out_api_key_hashes: NotRequired[List[str]] + r"""API key hashes""" + opted_out_member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + + +class UpdateModelAvailabilityGuardrailPolicyRequest(BaseModel): + config: GuardrailModelAvailabilityPolicyAuthoringConfig + + name: str + r"""Policy name""" + + workspace_id: str + r"""Workspace the policy belongs to""" + + api_key_hashes: Optional[List[str]] = None + r"""Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.""" + + is_workspace_default: Optional[bool] = None + r"""Omit to keep the stored default status; `false` unsets the policy as the workspace default.""" + + member_ids: Optional[List[str]] = None + r"""Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.""" + + opted_out_api_key_hashes: Optional[List[str]] = None + r"""API key hashes""" + + opted_out_member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "api_key_hashes", + "is_workspace_default", + "member_ids", + "opted_out_api_key_hashes", + "opted_out_member_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/updatemoderationguardrailpolicyrequest.py b/src/openrouter/components/updatemoderationguardrailpolicyrequest.py new file mode 100644 index 000000000..ddfa0c4e3 --- /dev/null +++ b/src/openrouter/components/updatemoderationguardrailpolicyrequest.py @@ -0,0 +1,78 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .guardrailmoderationpolicyconfig import ( + GuardrailModerationPolicyConfig, + GuardrailModerationPolicyConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class UpdateModerationGuardrailPolicyRequestTypedDict(TypedDict): + config: GuardrailModerationPolicyConfigTypedDict + name: str + r"""Policy name""" + workspace_id: str + r"""Workspace the policy belongs to""" + api_key_hashes: NotRequired[List[str]] + r"""Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.""" + is_workspace_default: NotRequired[bool] + r"""Omit to keep the stored default status; `false` unsets the policy as the workspace default.""" + member_ids: NotRequired[List[str]] + r"""Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.""" + opted_out_api_key_hashes: NotRequired[List[str]] + r"""API key hashes""" + opted_out_member_ids: NotRequired[List[str]] + r"""Organization member user IDs""" + + +class UpdateModerationGuardrailPolicyRequest(BaseModel): + config: GuardrailModerationPolicyConfig + + name: str + r"""Policy name""" + + workspace_id: str + r"""Workspace the policy belongs to""" + + api_key_hashes: Optional[List[str]] = None + r"""Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments.""" + + is_workspace_default: Optional[bool] = None + r"""Omit to keep the stored default status; `false` unsets the policy as the workspace default.""" + + member_ids: Optional[List[str]] = None + r"""Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments.""" + + opted_out_api_key_hashes: Optional[List[str]] = None + r"""API key hashes""" + + opted_out_member_ids: Optional[List[str]] = None + r"""Organization member user IDs""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "api_key_hashes", + "is_workspace_default", + "member_ids", + "opted_out_api_key_hashes", + "opted_out_member_ids", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/guardrail_policies.py b/src/openrouter/guardrail_policies.py new file mode 100644 index 000000000..9f5800f27 --- /dev/null +++ b/src/openrouter/guardrail_policies.py @@ -0,0 +1,7636 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from jsonpath import JSONPath +from openrouter import components, errors, operations, utils +from openrouter._hooks import HookContext +from openrouter.types import OptionalNullable, UNSET +from openrouter.utils import get_security_from_env +from openrouter.utils.unmarshal_json_response import unmarshal_json_response +from typing import Any, Awaitable, Dict, Iterable, List, Mapping, Optional, Union + + +class GuardrailPolicies(BaseSDK): + r"""Guardrail Policies endpoints""" + + def list_account_policies( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListAccountPoliciesResponse]: + r"""List workspace-wide policies + + List the workspace-wide policies that apply across workspaces in the account. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListAccountPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/account", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListAccountPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listAccountPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.ListAccountPoliciesResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list_account_policies( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListAccountPoliciesResponse( + result=unmarshal_json_response( + components.ListAccountGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_account_policies_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListAccountPoliciesResponse]: + r"""List workspace-wide policies + + List the workspace-wide policies that apply across workspaces in the account. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListAccountPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/account", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListAccountPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listAccountPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Awaitable[Optional[operations.ListAccountPoliciesResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_account_policies_async( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListAccountPoliciesResponse( + result=unmarshal_json_response( + components.ListAccountGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def create_account_policy( + self, + *, + account_guardrail_policy_request: Union[ + components.AccountGuardrailPolicyRequest, + components.AccountGuardrailPolicyRequestTypedDict, + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.AccountGuardrailPolicyResponse: + r"""Create a workspace-wide policy + + Create a workspace-wide budget, moderation, or model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param account_guardrail_policy_request: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateAccountPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + account_guardrail_policy_request=utils.get_pydantic_model( + account_guardrail_policy_request, + components.AccountGuardrailPolicyRequest, + ), + ) + + req = self._build_request( + method="POST", + path="/guardrails/policies/account", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateAccountPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.account_guardrail_policy_request, + False, + False, + "json", + components.AccountGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createAccountPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.AccountGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def create_account_policy_async( + self, + *, + account_guardrail_policy_request: Union[ + components.AccountGuardrailPolicyRequest, + components.AccountGuardrailPolicyRequestTypedDict, + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.AccountGuardrailPolicyResponse: + r"""Create a workspace-wide policy + + Create a workspace-wide budget, moderation, or model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param account_guardrail_policy_request: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateAccountPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + account_guardrail_policy_request=utils.get_pydantic_model( + account_guardrail_policy_request, + components.AccountGuardrailPolicyRequest, + ), + ) + + req = self._build_request_async( + method="POST", + path="/guardrails/policies/account", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateAccountPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.account_guardrail_policy_request, + False, + False, + "json", + components.AccountGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createAccountPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.AccountGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def delete_account_policy( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a workspace-wide policy + + Delete a workspace-wide policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteAccountPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request( + method="DELETE", + path="/guardrails/policies/account/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteAccountPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteAccountPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def delete_account_policy_async( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a workspace-wide policy + + Delete a workspace-wide policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteAccountPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request_async( + method="DELETE", + path="/guardrails/policies/account/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteAccountPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteAccountPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def update_account_policy( + self, + *, + id: str, + account_guardrail_policy_request: Union[ + components.AccountGuardrailPolicyRequest, + components.AccountGuardrailPolicyRequestTypedDict, + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.AccountGuardrailPolicyResponse: + r"""Update a workspace-wide policy + + Replace a workspace-wide policy and its workspace coverage. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param account_guardrail_policy_request: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateAccountPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + account_guardrail_policy_request=utils.get_pydantic_model( + account_guardrail_policy_request, + components.AccountGuardrailPolicyRequest, + ), + ) + + req = self._build_request( + method="PUT", + path="/guardrails/policies/account/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateAccountPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.account_guardrail_policy_request, + False, + False, + "json", + components.AccountGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateAccountPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.AccountGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def update_account_policy_async( + self, + *, + id: str, + account_guardrail_policy_request: Union[ + components.AccountGuardrailPolicyRequest, + components.AccountGuardrailPolicyRequestTypedDict, + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.AccountGuardrailPolicyResponse: + r"""Update a workspace-wide policy + + Replace a workspace-wide policy and its workspace coverage. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param account_guardrail_policy_request: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateAccountPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + account_guardrail_policy_request=utils.get_pydantic_model( + account_guardrail_policy_request, + components.AccountGuardrailPolicyRequest, + ), + ) + + req = self._build_request_async( + method="PUT", + path="/guardrails/policies/account/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateAccountPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.account_guardrail_policy_request, + False, + False, + "json", + components.AccountGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateAccountPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.AccountGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_api_key_policy_assignment( + self, + *, + hash: str, + workspace_id: str, + policy_type: operations.GetAPIKeyPolicyAssignmentPolicyType, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GuardrailPolicyAssignmentResponse: + r"""Get an API key policy assignment + + Get the policies of one type that apply to an API key in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param hash: API key hash + :param workspace_id: Workspace the policy belongs to + :param policy_type: Policy type the assignment is read or changed for + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetAPIKeyPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + hash=hash, + workspace_id=workspace_id, + policy_type=policy_type, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/assignments/api-keys/{hash}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetAPIKeyPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getApiKeyPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.GuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_api_key_policy_assignment_async( + self, + *, + hash: str, + workspace_id: str, + policy_type: operations.GetAPIKeyPolicyAssignmentPolicyType, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GuardrailPolicyAssignmentResponse: + r"""Get an API key policy assignment + + Get the policies of one type that apply to an API key in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param hash: API key hash + :param workspace_id: Workspace the policy belongs to + :param policy_type: Policy type the assignment is read or changed for + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetAPIKeyPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + hash=hash, + workspace_id=workspace_id, + policy_type=policy_type, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/assignments/api-keys/{hash}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetAPIKeyPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getApiKeyPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.GuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def change_api_key_policy_assignment( + self, + *, + hash: str, + assigned: bool, + expected_assignment: Union[ + components.GuardrailPolicyAssignmentState, + components.GuardrailPolicyAssignmentStateTypedDict, + ], + policy_id: str, + policy_type: components.ChangeGuardrailPolicyAssignmentRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ChangeGuardrailPolicyAssignmentResponse: + r"""Change an API key policy assignment + + Assign or unassign one policy for an API key. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param hash: API key hash + :param assigned: `true` assigns the policy to the subject, `false` removes it + :param expected_assignment: + :param policy_id: Policy ID + :param policy_type: Policy type the assignment is read or changed for + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ChangeAPIKeyPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + hash=hash, + change_guardrail_policy_assignment_request=components.ChangeGuardrailPolicyAssignmentRequest( + assigned=assigned, + expected_assignment=utils.get_pydantic_model( + expected_assignment, components.GuardrailPolicyAssignmentState + ), + policy_id=policy_id, + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="PUT", + path="/guardrails/policies/assignments/api-keys/{hash}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ChangeAPIKeyPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.change_guardrail_policy_assignment_request, + False, + False, + "json", + components.ChangeGuardrailPolicyAssignmentRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="changeApiKeyPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ChangeGuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def change_api_key_policy_assignment_async( + self, + *, + hash: str, + assigned: bool, + expected_assignment: Union[ + components.GuardrailPolicyAssignmentState, + components.GuardrailPolicyAssignmentStateTypedDict, + ], + policy_id: str, + policy_type: components.ChangeGuardrailPolicyAssignmentRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ChangeGuardrailPolicyAssignmentResponse: + r"""Change an API key policy assignment + + Assign or unassign one policy for an API key. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param hash: API key hash + :param assigned: `true` assigns the policy to the subject, `false` removes it + :param expected_assignment: + :param policy_id: Policy ID + :param policy_type: Policy type the assignment is read or changed for + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ChangeAPIKeyPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + hash=hash, + change_guardrail_policy_assignment_request=components.ChangeGuardrailPolicyAssignmentRequest( + assigned=assigned, + expected_assignment=utils.get_pydantic_model( + expected_assignment, components.GuardrailPolicyAssignmentState + ), + policy_id=policy_id, + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="PUT", + path="/guardrails/policies/assignments/api-keys/{hash}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ChangeAPIKeyPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.change_guardrail_policy_assignment_request, + False, + False, + "json", + components.ChangeGuardrailPolicyAssignmentRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="changeApiKeyPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ChangeGuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_member_policy_assignment( + self, + *, + member_id: str, + workspace_id: str, + policy_type: operations.GetMemberPolicyAssignmentPolicyType, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GuardrailPolicyAssignmentResponse: + r"""Get a member policy assignment + + Get the policies of one type that apply to a member in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param member_id: Organization member user ID + :param workspace_id: Workspace the policy belongs to + :param policy_type: Policy type the assignment is read or changed for + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetMemberPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + member_id=member_id, + workspace_id=workspace_id, + policy_type=policy_type, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/assignments/members/{member_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetMemberPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getMemberPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.GuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_member_policy_assignment_async( + self, + *, + member_id: str, + workspace_id: str, + policy_type: operations.GetMemberPolicyAssignmentPolicyType, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GuardrailPolicyAssignmentResponse: + r"""Get a member policy assignment + + Get the policies of one type that apply to a member in a workspace. Requires a management key with write access. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param member_id: Organization member user ID + :param workspace_id: Workspace the policy belongs to + :param policy_type: Policy type the assignment is read or changed for + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetMemberPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + member_id=member_id, + workspace_id=workspace_id, + policy_type=policy_type, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/assignments/members/{member_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetMemberPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getMemberPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.GuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def change_member_policy_assignment( + self, + *, + member_id: str, + assigned: bool, + expected_assignment: Union[ + components.GuardrailPolicyAssignmentState, + components.GuardrailPolicyAssignmentStateTypedDict, + ], + policy_id: str, + policy_type: components.ChangeGuardrailPolicyAssignmentRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ChangeGuardrailPolicyAssignmentResponse: + r"""Change a member policy assignment + + Assign or unassign one policy for a member. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param member_id: Organization member user ID + :param assigned: `true` assigns the policy to the subject, `false` removes it + :param expected_assignment: + :param policy_id: Policy ID + :param policy_type: Policy type the assignment is read or changed for + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ChangeMemberPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + member_id=member_id, + change_guardrail_policy_assignment_request=components.ChangeGuardrailPolicyAssignmentRequest( + assigned=assigned, + expected_assignment=utils.get_pydantic_model( + expected_assignment, components.GuardrailPolicyAssignmentState + ), + policy_id=policy_id, + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="PUT", + path="/guardrails/policies/assignments/members/{member_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ChangeMemberPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.change_guardrail_policy_assignment_request, + False, + False, + "json", + components.ChangeGuardrailPolicyAssignmentRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="changeMemberPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ChangeGuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def change_member_policy_assignment_async( + self, + *, + member_id: str, + assigned: bool, + expected_assignment: Union[ + components.GuardrailPolicyAssignmentState, + components.GuardrailPolicyAssignmentStateTypedDict, + ], + policy_id: str, + policy_type: components.ChangeGuardrailPolicyAssignmentRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ChangeGuardrailPolicyAssignmentResponse: + r"""Change a member policy assignment + + Assign or unassign one policy for a member. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param member_id: Organization member user ID + :param assigned: `true` assigns the policy to the subject, `false` removes it + :param expected_assignment: + :param policy_id: Policy ID + :param policy_type: Policy type the assignment is read or changed for + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ChangeMemberPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + member_id=member_id, + change_guardrail_policy_assignment_request=components.ChangeGuardrailPolicyAssignmentRequest( + assigned=assigned, + expected_assignment=utils.get_pydantic_model( + expected_assignment, components.GuardrailPolicyAssignmentState + ), + policy_id=policy_id, + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="PUT", + path="/guardrails/policies/assignments/members/{member_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ChangeMemberPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.change_guardrail_policy_assignment_request, + False, + False, + "json", + components.ChangeGuardrailPolicyAssignmentRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="changeMemberPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ChangeGuardrailPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_budget_policies( + self, + *, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListBudgetPoliciesResponse]: + r"""List budget policies + + List the budget policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListBudgetPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/budget", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListBudgetPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listBudgetPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.ListBudgetPoliciesResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list_budget_policies( + workspace_id=workspace_id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListBudgetPoliciesResponse( + result=unmarshal_json_response( + components.ListBudgetGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_budget_policies_async( + self, + *, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListBudgetPoliciesResponse]: + r"""List budget policies + + List the budget policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListBudgetPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/budget", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListBudgetPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listBudgetPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Awaitable[Optional[operations.ListBudgetPoliciesResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_budget_policies_async( + workspace_id=workspace_id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListBudgetPoliciesResponse( + result=unmarshal_json_response( + components.ListBudgetGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def create_budget_policy( + self, + *, + config: Union[ + components.GuardrailBudgetPolicyAuthoringConfig, + components.GuardrailBudgetPolicyAuthoringConfigTypedDict, + ], + name: str, + policy_type: components.CreateBudgetGuardrailPolicyRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BudgetGuardrailPolicyResponse: + r"""Create a budget policy + + Create a budget policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param config: + :param name: Policy name + :param policy_type: + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: API key hashes + :param is_workspace_default: Make this the workspace default for its policy type. Defaults to `false`. + :param member_ids: Organization member user IDs + :param opted_out_api_key_hashes: API keys that should not inherit the policy when it is the workspace default + :param opted_out_member_ids: Members that should not inherit the policy when it is the workspace default + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_budget_guardrail_policy_request=components.CreateBudgetGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailBudgetPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="POST", + path="/guardrails/policies/budget", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_budget_guardrail_policy_request, + False, + False, + "json", + components.CreateBudgetGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.BudgetGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def create_budget_policy_async( + self, + *, + config: Union[ + components.GuardrailBudgetPolicyAuthoringConfig, + components.GuardrailBudgetPolicyAuthoringConfigTypedDict, + ], + name: str, + policy_type: components.CreateBudgetGuardrailPolicyRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BudgetGuardrailPolicyResponse: + r"""Create a budget policy + + Create a budget policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param config: + :param name: Policy name + :param policy_type: + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: API key hashes + :param is_workspace_default: Make this the workspace default for its policy type. Defaults to `false`. + :param member_ids: Organization member user IDs + :param opted_out_api_key_hashes: API keys that should not inherit the policy when it is the workspace default + :param opted_out_member_ids: Members that should not inherit the policy when it is the workspace default + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_budget_guardrail_policy_request=components.CreateBudgetGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailBudgetPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="POST", + path="/guardrails/policies/budget", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_budget_guardrail_policy_request, + False, + False, + "json", + components.CreateBudgetGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.BudgetGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def delete_budget_policy( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a budget policy + + Delete a budget policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="DELETE", + path="/guardrails/policies/budget/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def delete_budget_policy_async( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a budget policy + + Delete a budget policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="DELETE", + path="/guardrails/policies/budget/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_budget_policy( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BudgetGuardrailPolicyDetailResponse: + r"""Get a budget policy + + Get a budget policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/budget/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BudgetGuardrailPolicyDetailResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_budget_policy_async( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BudgetGuardrailPolicyDetailResponse: + r"""Get a budget policy + + Get a budget policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/budget/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BudgetGuardrailPolicyDetailResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def update_budget_policy( + self, + *, + id: str, + config: Union[ + components.GuardrailBudgetPolicyAuthoringConfig, + components.GuardrailBudgetPolicyAuthoringConfigTypedDict, + ], + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BudgetGuardrailPolicyResponse: + r"""Update a budget policy + + Replace a budget policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param config: + :param name: Policy name + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. + :param is_workspace_default: Omit to keep the stored default status; `false` unsets the policy as the workspace default. + :param member_ids: Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. + :param opted_out_api_key_hashes: API key hashes + :param opted_out_member_ids: Organization member user IDs + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_budget_guardrail_policy_request=components.UpdateBudgetGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailBudgetPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="PUT", + path="/guardrails/policies/budget/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_budget_guardrail_policy_request, + False, + False, + "json", + components.UpdateBudgetGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BudgetGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def update_budget_policy_async( + self, + *, + id: str, + config: Union[ + components.GuardrailBudgetPolicyAuthoringConfig, + components.GuardrailBudgetPolicyAuthoringConfigTypedDict, + ], + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BudgetGuardrailPolicyResponse: + r"""Update a budget policy + + Replace a budget policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param config: + :param name: Policy name + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. + :param is_workspace_default: Omit to keep the stored default status; `false` unsets the policy as the workspace default. + :param member_ids: Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. + :param opted_out_api_key_hashes: API key hashes + :param opted_out_member_ids: Organization member user IDs + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateBudgetPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_budget_guardrail_policy_request=components.UpdateBudgetGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailBudgetPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="PUT", + path="/guardrails/policies/budget/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateBudgetPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_budget_guardrail_policy_request, + False, + False, + "json", + components.UpdateBudgetGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateBudgetPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BudgetGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_model_availability_policies( + self, + *, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListModelAvailabilityPoliciesResponse]: + r"""List model availability policies + + List the model availability policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListModelAvailabilityPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/model-availability", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListModelAvailabilityPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listModelAvailabilityPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.ListModelAvailabilityPoliciesResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list_model_availability_policies( + workspace_id=workspace_id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListModelAvailabilityPoliciesResponse( + result=unmarshal_json_response( + components.ListModelAvailabilityGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_model_availability_policies_async( + self, + *, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListModelAvailabilityPoliciesResponse]: + r"""List model availability policies + + List the model availability policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListModelAvailabilityPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/model-availability", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListModelAvailabilityPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listModelAvailabilityPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> ( + Awaitable[Optional[operations.ListModelAvailabilityPoliciesResponse]] + ): + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_model_availability_policies_async( + workspace_id=workspace_id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListModelAvailabilityPoliciesResponse( + result=unmarshal_json_response( + components.ListModelAvailabilityGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def create_model_availability_policy( + self, + *, + config: Union[ + components.GuardrailModelAvailabilityPolicyAuthoringConfig, + components.GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, + ], + name: str, + policy_type: components.CreateModelAvailabilityGuardrailPolicyRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelAvailabilityGuardrailPolicyResponse: + r"""Create a model availability policy + + Create a model availability policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param config: + :param name: Policy name + :param policy_type: + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: API key hashes + :param is_workspace_default: Make this the workspace default for its policy type. Defaults to `false`. + :param member_ids: Organization member user IDs + :param opted_out_api_key_hashes: API keys that should not inherit the policy when it is the workspace default + :param opted_out_member_ids: Members that should not inherit the policy when it is the workspace default + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_model_availability_guardrail_policy_request=components.CreateModelAvailabilityGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModelAvailabilityPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="POST", + path="/guardrails/policies/model-availability", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_model_availability_guardrail_policy_request, + False, + False, + "json", + components.CreateModelAvailabilityGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.ModelAvailabilityGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def create_model_availability_policy_async( + self, + *, + config: Union[ + components.GuardrailModelAvailabilityPolicyAuthoringConfig, + components.GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, + ], + name: str, + policy_type: components.CreateModelAvailabilityGuardrailPolicyRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelAvailabilityGuardrailPolicyResponse: + r"""Create a model availability policy + + Create a model availability policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param config: + :param name: Policy name + :param policy_type: + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: API key hashes + :param is_workspace_default: Make this the workspace default for its policy type. Defaults to `false`. + :param member_ids: Organization member user IDs + :param opted_out_api_key_hashes: API keys that should not inherit the policy when it is the workspace default + :param opted_out_member_ids: Members that should not inherit the policy when it is the workspace default + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_model_availability_guardrail_policy_request=components.CreateModelAvailabilityGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModelAvailabilityPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="POST", + path="/guardrails/policies/model-availability", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_model_availability_guardrail_policy_request, + False, + False, + "json", + components.CreateModelAvailabilityGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.ModelAvailabilityGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def delete_model_availability_policy( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a model availability policy + + Delete a model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="DELETE", + path="/guardrails/policies/model-availability/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def delete_model_availability_policy_async( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a model availability policy + + Delete a model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="DELETE", + path="/guardrails/policies/model-availability/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_model_availability_policy( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelAvailabilityGuardrailPolicyDetailResponse: + r"""Get a model availability policy + + Get a model availability policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/model-availability/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModelAvailabilityGuardrailPolicyDetailResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_model_availability_policy_async( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelAvailabilityGuardrailPolicyDetailResponse: + r"""Get a model availability policy + + Get a model availability policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/model-availability/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModelAvailabilityGuardrailPolicyDetailResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def update_model_availability_policy( + self, + *, + id: str, + config: Union[ + components.GuardrailModelAvailabilityPolicyAuthoringConfig, + components.GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, + ], + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelAvailabilityGuardrailPolicyResponse: + r"""Update a model availability policy + + Replace a model availability policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param config: + :param name: Policy name + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. + :param is_workspace_default: Omit to keep the stored default status; `false` unsets the policy as the workspace default. + :param member_ids: Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. + :param opted_out_api_key_hashes: API key hashes + :param opted_out_member_ids: Organization member user IDs + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_model_availability_guardrail_policy_request=components.UpdateModelAvailabilityGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModelAvailabilityPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="PUT", + path="/guardrails/policies/model-availability/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_model_availability_guardrail_policy_request, + False, + False, + "json", + components.UpdateModelAvailabilityGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModelAvailabilityGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def update_model_availability_policy_async( + self, + *, + id: str, + config: Union[ + components.GuardrailModelAvailabilityPolicyAuthoringConfig, + components.GuardrailModelAvailabilityPolicyAuthoringConfigTypedDict, + ], + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelAvailabilityGuardrailPolicyResponse: + r"""Update a model availability policy + + Replace a model availability policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param config: + :param name: Policy name + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. + :param is_workspace_default: Omit to keep the stored default status; `false` unsets the policy as the workspace default. + :param member_ids: Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. + :param opted_out_api_key_hashes: API key hashes + :param opted_out_member_ids: Organization member user IDs + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateModelAvailabilityPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_model_availability_guardrail_policy_request=components.UpdateModelAvailabilityGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModelAvailabilityPolicyAuthoringConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="PUT", + path="/guardrails/policies/model-availability/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateModelAvailabilityPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_model_availability_guardrail_policy_request, + False, + False, + "json", + components.UpdateModelAvailabilityGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateModelAvailabilityPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModelAvailabilityGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_moderation_policies( + self, + *, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListModerationPoliciesResponse]: + r"""List moderation policies + + List the moderation policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListModerationPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/moderation", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListModerationPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listModerationPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.ListModerationPoliciesResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list_moderation_policies( + workspace_id=workspace_id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListModerationPoliciesResponse( + result=unmarshal_json_response( + components.ListModerationGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_moderation_policies_async( + self, + *, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListModerationPoliciesResponse]: + r"""List moderation policies + + List the moderation policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListModerationPoliciesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/moderation", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListModerationPoliciesGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listModerationPolicies", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + def next_func() -> ( + Awaitable[Optional[operations.ListModerationPoliciesResponse]] + ): + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 0 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_moderation_policies_async( + workspace_id=workspace_id, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListModerationPoliciesResponse( + result=unmarshal_json_response( + components.ListModerationGuardrailPoliciesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def create_moderation_policy( + self, + *, + config: Union[ + components.GuardrailModerationPolicyConfig, + components.GuardrailModerationPolicyConfigTypedDict, + ], + name: str, + policy_type: components.CreateModerationGuardrailPolicyRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModerationGuardrailPolicyResponse: + r"""Create a moderation policy + + Create a moderation policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param config: + :param name: Policy name + :param policy_type: + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: API key hashes + :param is_workspace_default: Make this the workspace default for its policy type. Defaults to `false`. + :param member_ids: Organization member user IDs + :param opted_out_api_key_hashes: API keys that should not inherit the policy when it is the workspace default + :param opted_out_member_ids: Members that should not inherit the policy when it is the workspace default + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_moderation_guardrail_policy_request=components.CreateModerationGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModerationPolicyConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="POST", + path="/guardrails/policies/moderation", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_moderation_guardrail_policy_request, + False, + False, + "json", + components.CreateModerationGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.ModerationGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def create_moderation_policy_async( + self, + *, + config: Union[ + components.GuardrailModerationPolicyConfig, + components.GuardrailModerationPolicyConfigTypedDict, + ], + name: str, + policy_type: components.CreateModerationGuardrailPolicyRequestPolicyType, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModerationGuardrailPolicyResponse: + r"""Create a moderation policy + + Create a moderation policy in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param config: + :param name: Policy name + :param policy_type: + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: API key hashes + :param is_workspace_default: Make this the workspace default for its policy type. Defaults to `false`. + :param member_ids: Organization member user IDs + :param opted_out_api_key_hashes: API keys that should not inherit the policy when it is the workspace default + :param opted_out_member_ids: Members that should not inherit the policy when it is the workspace default + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.CreateModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_moderation_guardrail_policy_request=components.CreateModerationGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModerationPolicyConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + policy_type=policy_type, + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="POST", + path="/guardrails/policies/moderation", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.CreateModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_moderation_guardrail_policy_request, + False, + False, + "json", + components.CreateModerationGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response( + components.ModerationGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def delete_moderation_policy( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a moderation policy + + Delete a moderation policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="DELETE", + path="/guardrails/policies/moderation/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def delete_moderation_policy_async( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteGuardrailPolicyResponse: + r"""Delete a moderation policy + + Delete a moderation policy. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="DELETE", + path="/guardrails/policies/moderation/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_moderation_policy( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModerationGuardrailPolicyDetailResponse: + r"""Get a moderation policy + + Get a moderation policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/moderation/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModerationGuardrailPolicyDetailResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_moderation_policy_async( + self, + *, + id: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModerationGuardrailPolicyDetailResponse: + r"""Get a moderation policy + + Get a moderation policy with its member and API key assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/moderation/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModerationGuardrailPolicyDetailResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def update_moderation_policy( + self, + *, + id: str, + config: Union[ + components.GuardrailModerationPolicyConfig, + components.GuardrailModerationPolicyConfigTypedDict, + ], + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModerationGuardrailPolicyResponse: + r"""Update a moderation policy + + Replace a moderation policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param config: + :param name: Policy name + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. + :param is_workspace_default: Omit to keep the stored default status; `false` unsets the policy as the workspace default. + :param member_ids: Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. + :param opted_out_api_key_hashes: API key hashes + :param opted_out_member_ids: Organization member user IDs + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_moderation_guardrail_policy_request=components.UpdateModerationGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModerationPolicyConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + workspace_id=workspace_id, + ), + ) + + req = self._build_request( + method="PUT", + path="/guardrails/policies/moderation/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_moderation_guardrail_policy_request, + False, + False, + "json", + components.UpdateModerationGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModerationGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def update_moderation_policy_async( + self, + *, + id: str, + config: Union[ + components.GuardrailModerationPolicyConfig, + components.GuardrailModerationPolicyConfigTypedDict, + ], + name: str, + workspace_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + api_key_hashes: Optional[Iterable[str]] = None, + is_workspace_default: Optional[bool] = None, + member_ids: Optional[Iterable[str]] = None, + opted_out_api_key_hashes: Optional[Iterable[str]] = None, + opted_out_member_ids: Optional[Iterable[str]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModerationGuardrailPolicyResponse: + r"""Update a moderation policy + + Replace a moderation policy's name and config, and optionally its assignments. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: Policy ID + :param config: + :param name: Policy name + :param workspace_id: Workspace the policy belongs to + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param api_key_hashes: Complete new list of assigned API keys. Send together with `member_ids`, or omit both to keep the stored assignments. + :param is_workspace_default: Omit to keep the stored default status; `false` unsets the policy as the workspace default. + :param member_ids: Complete new list of assigned members. Send together with `api_key_hashes`, or omit both to keep the stored assignments. + :param opted_out_api_key_hashes: API key hashes + :param opted_out_member_ids: Organization member user IDs + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.UpdateModerationPolicyRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_moderation_guardrail_policy_request=components.UpdateModerationGuardrailPolicyRequest( + api_key_hashes=utils.unmarshal(api_key_hashes, Optional[List[str]]), + config=utils.get_pydantic_model( + config, components.GuardrailModerationPolicyConfig + ), + is_workspace_default=is_workspace_default, + member_ids=utils.unmarshal(member_ids, Optional[List[str]]), + name=name, + opted_out_api_key_hashes=utils.unmarshal( + opted_out_api_key_hashes, Optional[List[str]] + ), + opted_out_member_ids=utils.unmarshal( + opted_out_member_ids, Optional[List[str]] + ), + workspace_id=workspace_id, + ), + ) + + req = self._build_request_async( + method="PUT", + path="/guardrails/policies/moderation/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateModerationPolicyGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_moderation_guardrail_policy_request, + False, + False, + "json", + components.UpdateModerationGuardrailPolicyRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateModerationPolicy", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ModerationGuardrailPolicyResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 6f0b96c55..488f95f3b 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -47,12 +47,30 @@ BulkUnassignMembersFromGuardrailRequest, BulkUnassignMembersFromGuardrailRequestTypedDict, ) + from .changeapikeypolicyassignment import ( + ChangeAPIKeyPolicyAssignmentGlobals, + ChangeAPIKeyPolicyAssignmentGlobalsTypedDict, + ChangeAPIKeyPolicyAssignmentRequest, + ChangeAPIKeyPolicyAssignmentRequestTypedDict, + ) + from .changememberpolicyassignment import ( + ChangeMemberPolicyAssignmentGlobals, + ChangeMemberPolicyAssignmentGlobalsTypedDict, + ChangeMemberPolicyAssignmentRequest, + ChangeMemberPolicyAssignmentRequestTypedDict, + ) from .copyvaultsecretstointern import ( CopyVaultSecretsToInternGlobals, CopyVaultSecretsToInternGlobalsTypedDict, CopyVaultSecretsToInternRequest, CopyVaultSecretsToInternRequestTypedDict, ) + from .createaccountpolicy import ( + CreateAccountPolicyGlobals, + CreateAccountPolicyGlobalsTypedDict, + CreateAccountPolicyRequest, + CreateAccountPolicyRequestTypedDict, + ) from .createapialphadecisions import ( CREATE_API_ALPHA_DECISIONS_SERVERS, CreateAPIAlphaDecisionsGlobals, @@ -111,6 +129,12 @@ CreateBatchesRequest, CreateBatchesRequestTypedDict, ) + from .createbudgetpolicy import ( + CreateBudgetPolicyGlobals, + CreateBudgetPolicyGlobalsTypedDict, + CreateBudgetPolicyRequest, + CreateBudgetPolicyRequestTypedDict, + ) from .createbyokkey import ( CreateBYOKKeyGlobals, CreateBYOKKeyGlobalsTypedDict, @@ -189,6 +213,18 @@ External, ExternalTypedDict, ) + from .createmodelavailabilitypolicy import ( + CreateModelAvailabilityPolicyGlobals, + CreateModelAvailabilityPolicyGlobalsTypedDict, + CreateModelAvailabilityPolicyRequest, + CreateModelAvailabilityPolicyRequestTypedDict, + ) + from .createmoderationpolicy import ( + CreateModerationPolicyGlobals, + CreateModerationPolicyGlobalsTypedDict, + CreateModerationPolicyRequest, + CreateModerationPolicyRequestTypedDict, + ) from .createoauthtoken import ( CreateOauthTokenGlobals, CreateOauthTokenGlobalsTypedDict, @@ -295,12 +331,24 @@ CreateWorkspaceRequest, CreateWorkspaceRequestTypedDict, ) + from .deleteaccountpolicy import ( + DeleteAccountPolicyGlobals, + DeleteAccountPolicyGlobalsTypedDict, + DeleteAccountPolicyRequest, + DeleteAccountPolicyRequestTypedDict, + ) from .deletebatch import ( DeleteBatchGlobals, DeleteBatchGlobalsTypedDict, DeleteBatchRequest, DeleteBatchRequestTypedDict, ) + from .deletebudgetpolicy import ( + DeleteBudgetPolicyGlobals, + DeleteBudgetPolicyGlobalsTypedDict, + DeleteBudgetPolicyRequest, + DeleteBudgetPolicyRequestTypedDict, + ) from .deletebyokkey import ( DeleteBYOKKeyGlobals, DeleteBYOKKeyGlobalsTypedDict, @@ -339,6 +387,18 @@ DeleteKeysResponse, DeleteKeysResponseTypedDict, ) + from .deletemodelavailabilitypolicy import ( + DeleteModelAvailabilityPolicyGlobals, + DeleteModelAvailabilityPolicyGlobalsTypedDict, + DeleteModelAvailabilityPolicyRequest, + DeleteModelAvailabilityPolicyRequestTypedDict, + ) + from .deletemoderationpolicy import ( + DeleteModerationPolicyGlobals, + DeleteModerationPolicyGlobalsTypedDict, + DeleteModerationPolicyRequest, + DeleteModerationPolicyRequestTypedDict, + ) from .deleteobservabilitydestination import ( DeleteObservabilityDestinationGlobals, DeleteObservabilityDestinationGlobalsTypedDict, @@ -442,6 +502,13 @@ MetricTypedDict, Name, ) + from .getapikeypolicyassignment import ( + GetAPIKeyPolicyAssignmentGlobals, + GetAPIKeyPolicyAssignmentGlobalsTypedDict, + GetAPIKeyPolicyAssignmentPolicyType, + GetAPIKeyPolicyAssignmentRequest, + GetAPIKeyPolicyAssignmentRequestTypedDict, + ) from .getapprankings import ( GetAppRankingsCategory, GetAppRankingsGlobals, @@ -470,6 +537,12 @@ Source, TaskType, ) + from .getbudgetpolicy import ( + GetBudgetPolicyGlobals, + GetBudgetPolicyGlobalsTypedDict, + GetBudgetPolicyRequest, + GetBudgetPolicyRequestTypedDict, + ) from .getbyokkey import ( GetBYOKKeyGlobals, GetBYOKKeyGlobalsTypedDict, @@ -539,12 +612,25 @@ GetKeyResponse, GetKeyResponseTypedDict, ) + from .getmemberpolicyassignment import ( + GetMemberPolicyAssignmentGlobals, + GetMemberPolicyAssignmentGlobalsTypedDict, + GetMemberPolicyAssignmentPolicyType, + GetMemberPolicyAssignmentRequest, + GetMemberPolicyAssignmentRequestTypedDict, + ) from .getmodel import ( GetModelGlobals, GetModelGlobalsTypedDict, GetModelRequest, GetModelRequestTypedDict, ) + from .getmodelavailabilitypolicy import ( + GetModelAvailabilityPolicyGlobals, + GetModelAvailabilityPolicyGlobalsTypedDict, + GetModelAvailabilityPolicyRequest, + GetModelAvailabilityPolicyRequestTypedDict, + ) from .getmodels import ( Distillable, GetModelsCategory, @@ -558,6 +644,12 @@ Region, Zdr, ) + from .getmoderationpolicy import ( + GetModerationPolicyGlobals, + GetModerationPolicyGlobalsTypedDict, + GetModerationPolicyRequest, + GetModerationPolicyRequestTypedDict, + ) from .getobservabilitydestination import ( GetObservabilityDestinationGlobals, GetObservabilityDestinationGlobalsTypedDict, @@ -684,6 +776,14 @@ ListResponseBodyTypedDict, ListResponseTypedDict, ) + from .listaccountpolicies import ( + ListAccountPoliciesGlobals, + ListAccountPoliciesGlobalsTypedDict, + ListAccountPoliciesRequest, + ListAccountPoliciesRequestTypedDict, + ListAccountPoliciesResponse, + ListAccountPoliciesResponseTypedDict, + ) from .listbatches import ( ListBatchesGlobals, ListBatchesGlobalsTypedDict, @@ -692,6 +792,14 @@ ListBatchesResponse, ListBatchesResponseTypedDict, ) + from .listbudgetpolicies import ( + ListBudgetPoliciesGlobals, + ListBudgetPoliciesGlobalsTypedDict, + ListBudgetPoliciesRequest, + ListBudgetPoliciesRequestTypedDict, + ListBudgetPoliciesResponse, + ListBudgetPoliciesResponseTypedDict, + ) from .listbyokkeys import ( ListBYOKKeysGlobals, ListBYOKKeysGlobalsTypedDict, @@ -828,6 +936,14 @@ ListMemberAssignmentsResponse, ListMemberAssignmentsResponseTypedDict, ) + from .listmodelavailabilitypolicies import ( + ListModelAvailabilityPoliciesGlobals, + ListModelAvailabilityPoliciesGlobalsTypedDict, + ListModelAvailabilityPoliciesRequest, + ListModelAvailabilityPoliciesRequestTypedDict, + ListModelAvailabilityPoliciesResponse, + ListModelAvailabilityPoliciesResponseTypedDict, + ) from .listmodelscount import ( ListModelsCountGlobals, ListModelsCountGlobalsTypedDict, @@ -846,6 +962,14 @@ ListModelsUserSecurityTypedDict, ListModelsUserSort, ) + from .listmoderationpolicies import ( + ListModerationPoliciesGlobals, + ListModerationPoliciesGlobalsTypedDict, + ListModerationPoliciesRequest, + ListModerationPoliciesRequestTypedDict, + ListModerationPoliciesResponse, + ListModerationPoliciesResponseTypedDict, + ) from .listoauthjwks import ( ListOauthJwksGlobals, ListOauthJwksGlobalsTypedDict, @@ -1037,6 +1161,18 @@ SubmitGenerationFeedbackRequest, SubmitGenerationFeedbackRequestTypedDict, ) + from .updateaccountpolicy import ( + UpdateAccountPolicyGlobals, + UpdateAccountPolicyGlobalsTypedDict, + UpdateAccountPolicyRequest, + UpdateAccountPolicyRequestTypedDict, + ) + from .updatebudgetpolicy import ( + UpdateBudgetPolicyGlobals, + UpdateBudgetPolicyGlobalsTypedDict, + UpdateBudgetPolicyRequest, + UpdateBudgetPolicyRequestTypedDict, + ) from .updatebyokkey import ( UpdateBYOKKeyGlobals, UpdateBYOKKeyGlobalsTypedDict, @@ -1068,6 +1204,18 @@ UpdateKeysResponse, UpdateKeysResponseTypedDict, ) + from .updatemodelavailabilitypolicy import ( + UpdateModelAvailabilityPolicyGlobals, + UpdateModelAvailabilityPolicyGlobalsTypedDict, + UpdateModelAvailabilityPolicyRequest, + UpdateModelAvailabilityPolicyRequestTypedDict, + ) + from .updatemoderationpolicy import ( + UpdateModerationPolicyGlobals, + UpdateModerationPolicyGlobalsTypedDict, + UpdateModerationPolicyRequest, + UpdateModerationPolicyRequestTypedDict, + ) from .updateobservabilitydestination import ( UpdateObservabilityDestinationGlobals, UpdateObservabilityDestinationGlobalsTypedDict, @@ -1166,6 +1314,14 @@ "BulkUnassignMembersFromGuardrailRequestTypedDict", "CREATE_API_ALPHA_DECISIONS_SERVERS", "CREATE_API_ALPHA_EXTRACTIONS_SERVERS", + "ChangeAPIKeyPolicyAssignmentGlobals", + "ChangeAPIKeyPolicyAssignmentGlobalsTypedDict", + "ChangeAPIKeyPolicyAssignmentRequest", + "ChangeAPIKeyPolicyAssignmentRequestTypedDict", + "ChangeMemberPolicyAssignmentGlobals", + "ChangeMemberPolicyAssignmentGlobalsTypedDict", + "ChangeMemberPolicyAssignmentRequest", + "ChangeMemberPolicyAssignmentRequestTypedDict", "ClassifierDimensions", "ClassifierDimensionsTypedDict", "ClassifierFilters", @@ -1190,6 +1346,10 @@ "CreateAPIAlphaExtractionsGlobalsTypedDict", "CreateAPIAlphaExtractionsRequest", "CreateAPIAlphaExtractionsRequestTypedDict", + "CreateAccountPolicyGlobals", + "CreateAccountPolicyGlobalsTypedDict", + "CreateAccountPolicyRequest", + "CreateAccountPolicyRequestTypedDict", "CreateAudioSpeechGlobals", "CreateAudioSpeechGlobalsTypedDict", "CreateAudioSpeechRequest", @@ -1225,6 +1385,10 @@ "CreateBatchesGlobalsTypedDict", "CreateBatchesRequest", "CreateBatchesRequestTypedDict", + "CreateBudgetPolicyGlobals", + "CreateBudgetPolicyGlobalsTypedDict", + "CreateBudgetPolicyRequest", + "CreateBudgetPolicyRequestTypedDict", "CreateEmbeddingsData", "CreateEmbeddingsDataTypedDict", "CreateEmbeddingsGlobals", @@ -1264,6 +1428,14 @@ "CreateKeysRequestTypedDict", "CreateKeysResponse", "CreateKeysResponseTypedDict", + "CreateModelAvailabilityPolicyGlobals", + "CreateModelAvailabilityPolicyGlobalsTypedDict", + "CreateModelAvailabilityPolicyRequest", + "CreateModelAvailabilityPolicyRequestTypedDict", + "CreateModerationPolicyGlobals", + "CreateModerationPolicyGlobalsTypedDict", + "CreateModerationPolicyRequest", + "CreateModerationPolicyRequestTypedDict", "CreateOauthTokenGlobals", "CreateOauthTokenGlobalsTypedDict", "CreateOauthTokenRequest", @@ -1335,6 +1507,10 @@ "CreateWorkspaceRequest", "CreateWorkspaceRequestTypedDict", "Datacenter", + "DeleteAccountPolicyGlobals", + "DeleteAccountPolicyGlobalsTypedDict", + "DeleteAccountPolicyRequest", + "DeleteAccountPolicyRequestTypedDict", "DeleteBYOKKeyGlobals", "DeleteBYOKKeyGlobalsTypedDict", "DeleteBYOKKeyRequest", @@ -1343,6 +1519,10 @@ "DeleteBatchGlobalsTypedDict", "DeleteBatchRequest", "DeleteBatchRequestTypedDict", + "DeleteBudgetPolicyGlobals", + "DeleteBudgetPolicyGlobalsTypedDict", + "DeleteBudgetPolicyRequest", + "DeleteBudgetPolicyRequestTypedDict", "DeleteExternalUserGlobals", "DeleteExternalUserGlobalsTypedDict", "DeleteExternalUserRequest", @@ -1365,6 +1545,14 @@ "DeleteKeysRequestTypedDict", "DeleteKeysResponse", "DeleteKeysResponseTypedDict", + "DeleteModelAvailabilityPolicyGlobals", + "DeleteModelAvailabilityPolicyGlobalsTypedDict", + "DeleteModelAvailabilityPolicyRequest", + "DeleteModelAvailabilityPolicyRequestTypedDict", + "DeleteModerationPolicyGlobals", + "DeleteModerationPolicyGlobalsTypedDict", + "DeleteModerationPolicyRequest", + "DeleteModerationPolicyRequestTypedDict", "DeleteObservabilityDestinationGlobals", "DeleteObservabilityDestinationGlobalsTypedDict", "DeleteObservabilityDestinationRequest", @@ -1439,6 +1627,11 @@ "ExchangeAuthCodeForAPIKeyResponseTypedDict", "External", "ExternalTypedDict", + "GetAPIKeyPolicyAssignmentGlobals", + "GetAPIKeyPolicyAssignmentGlobalsTypedDict", + "GetAPIKeyPolicyAssignmentPolicyType", + "GetAPIKeyPolicyAssignmentRequest", + "GetAPIKeyPolicyAssignmentRequestTypedDict", "GetAnalyticsMetaData", "GetAnalyticsMetaDataTypedDict", "GetAnalyticsMetaGlobals", @@ -1467,6 +1660,10 @@ "GetBenchmarksGlobalsTypedDict", "GetBenchmarksRequest", "GetBenchmarksRequestTypedDict", + "GetBudgetPolicyGlobals", + "GetBudgetPolicyGlobalsTypedDict", + "GetBudgetPolicyRequest", + "GetBudgetPolicyRequestTypedDict", "GetContainerFileGlobals", "GetContainerFileGlobalsTypedDict", "GetContainerFileRequest", @@ -1511,6 +1708,15 @@ "GetKeyRequestTypedDict", "GetKeyResponse", "GetKeyResponseTypedDict", + "GetMemberPolicyAssignmentGlobals", + "GetMemberPolicyAssignmentGlobalsTypedDict", + "GetMemberPolicyAssignmentPolicyType", + "GetMemberPolicyAssignmentRequest", + "GetMemberPolicyAssignmentRequestTypedDict", + "GetModelAvailabilityPolicyGlobals", + "GetModelAvailabilityPolicyGlobalsTypedDict", + "GetModelAvailabilityPolicyRequest", + "GetModelAvailabilityPolicyRequestTypedDict", "GetModelGlobals", "GetModelGlobalsTypedDict", "GetModelRequest", @@ -1523,6 +1729,10 @@ "GetModelsResponse", "GetModelsResponseTypedDict", "GetModelsSort", + "GetModerationPolicyGlobals", + "GetModerationPolicyGlobalsTypedDict", + "GetModerationPolicyRequest", + "GetModerationPolicyRequestTypedDict", "GetObservabilityDestinationGlobals", "GetObservabilityDestinationGlobalsTypedDict", "GetObservabilityDestinationRequest", @@ -1612,6 +1822,12 @@ "KeepMembersEnum", "KeepMembersTypedDict", "LanguageType", + "ListAccountPoliciesGlobals", + "ListAccountPoliciesGlobalsTypedDict", + "ListAccountPoliciesRequest", + "ListAccountPoliciesRequestTypedDict", + "ListAccountPoliciesResponse", + "ListAccountPoliciesResponseTypedDict", "ListBYOKKeysGlobals", "ListBYOKKeysGlobalsTypedDict", "ListBYOKKeysRequest", @@ -1624,6 +1840,12 @@ "ListBatchesRequestTypedDict", "ListBatchesResponse", "ListBatchesResponseTypedDict", + "ListBudgetPoliciesGlobals", + "ListBudgetPoliciesGlobalsTypedDict", + "ListBudgetPoliciesRequest", + "ListBudgetPoliciesRequestTypedDict", + "ListBudgetPoliciesResponse", + "ListBudgetPoliciesResponseTypedDict", "ListContainerFilesGlobals", "ListContainerFilesGlobalsTypedDict", "ListContainerFilesRequest", @@ -1720,6 +1942,12 @@ "ListMemberAssignmentsRequestTypedDict", "ListMemberAssignmentsResponse", "ListMemberAssignmentsResponseTypedDict", + "ListModelAvailabilityPoliciesGlobals", + "ListModelAvailabilityPoliciesGlobalsTypedDict", + "ListModelAvailabilityPoliciesRequest", + "ListModelAvailabilityPoliciesRequestTypedDict", + "ListModelAvailabilityPoliciesResponse", + "ListModelAvailabilityPoliciesResponseTypedDict", "ListModelsCountGlobals", "ListModelsCountGlobalsTypedDict", "ListModelsCountRequest", @@ -1733,6 +1961,12 @@ "ListModelsUserSecurity", "ListModelsUserSecurityTypedDict", "ListModelsUserSort", + "ListModerationPoliciesGlobals", + "ListModerationPoliciesGlobalsTypedDict", + "ListModerationPoliciesRequest", + "ListModerationPoliciesRequestTypedDict", + "ListModerationPoliciesResponse", + "ListModerationPoliciesResponseTypedDict", "ListOauthJwksGlobals", "ListOauthJwksGlobalsTypedDict", "ListOauthJwksRequest", @@ -1901,10 +2135,18 @@ "TurnRange", "TypeImageURL", "TypeText", + "UpdateAccountPolicyGlobals", + "UpdateAccountPolicyGlobalsTypedDict", + "UpdateAccountPolicyRequest", + "UpdateAccountPolicyRequestTypedDict", "UpdateBYOKKeyGlobals", "UpdateBYOKKeyGlobalsTypedDict", "UpdateBYOKKeyRequest", "UpdateBYOKKeyRequestTypedDict", + "UpdateBudgetPolicyGlobals", + "UpdateBudgetPolicyGlobalsTypedDict", + "UpdateBudgetPolicyRequest", + "UpdateBudgetPolicyRequestTypedDict", "UpdateExternalUserGlobals", "UpdateExternalUserGlobalsTypedDict", "UpdateExternalUserRequest", @@ -1924,6 +2166,14 @@ "UpdateKeysRequestTypedDict", "UpdateKeysResponse", "UpdateKeysResponseTypedDict", + "UpdateModelAvailabilityPolicyGlobals", + "UpdateModelAvailabilityPolicyGlobalsTypedDict", + "UpdateModelAvailabilityPolicyRequest", + "UpdateModelAvailabilityPolicyRequestTypedDict", + "UpdateModerationPolicyGlobals", + "UpdateModerationPolicyGlobalsTypedDict", + "UpdateModerationPolicyRequest", + "UpdateModerationPolicyRequestTypedDict", "UpdateObservabilityDestinationGlobals", "UpdateObservabilityDestinationGlobalsTypedDict", "UpdateObservabilityDestinationRequest", @@ -2002,10 +2252,22 @@ "BulkUnassignMembersFromGuardrailGlobalsTypedDict": ".bulkunassignmembersfromguardrail", "BulkUnassignMembersFromGuardrailRequest": ".bulkunassignmembersfromguardrail", "BulkUnassignMembersFromGuardrailRequestTypedDict": ".bulkunassignmembersfromguardrail", + "ChangeAPIKeyPolicyAssignmentGlobals": ".changeapikeypolicyassignment", + "ChangeAPIKeyPolicyAssignmentGlobalsTypedDict": ".changeapikeypolicyassignment", + "ChangeAPIKeyPolicyAssignmentRequest": ".changeapikeypolicyassignment", + "ChangeAPIKeyPolicyAssignmentRequestTypedDict": ".changeapikeypolicyassignment", + "ChangeMemberPolicyAssignmentGlobals": ".changememberpolicyassignment", + "ChangeMemberPolicyAssignmentGlobalsTypedDict": ".changememberpolicyassignment", + "ChangeMemberPolicyAssignmentRequest": ".changememberpolicyassignment", + "ChangeMemberPolicyAssignmentRequestTypedDict": ".changememberpolicyassignment", "CopyVaultSecretsToInternGlobals": ".copyvaultsecretstointern", "CopyVaultSecretsToInternGlobalsTypedDict": ".copyvaultsecretstointern", "CopyVaultSecretsToInternRequest": ".copyvaultsecretstointern", "CopyVaultSecretsToInternRequestTypedDict": ".copyvaultsecretstointern", + "CreateAccountPolicyGlobals": ".createaccountpolicy", + "CreateAccountPolicyGlobalsTypedDict": ".createaccountpolicy", + "CreateAccountPolicyRequest": ".createaccountpolicy", + "CreateAccountPolicyRequestTypedDict": ".createaccountpolicy", "CREATE_API_ALPHA_DECISIONS_SERVERS": ".createapialphadecisions", "CreateAPIAlphaDecisionsGlobals": ".createapialphadecisions", "CreateAPIAlphaDecisionsGlobalsTypedDict": ".createapialphadecisions", @@ -2050,6 +2312,10 @@ "CreateBatchesGlobalsTypedDict": ".createbatches", "CreateBatchesRequest": ".createbatches", "CreateBatchesRequestTypedDict": ".createbatches", + "CreateBudgetPolicyGlobals": ".createbudgetpolicy", + "CreateBudgetPolicyGlobalsTypedDict": ".createbudgetpolicy", + "CreateBudgetPolicyRequest": ".createbudgetpolicy", + "CreateBudgetPolicyRequestTypedDict": ".createbudgetpolicy", "CreateBYOKKeyGlobals": ".createbyokkey", "CreateBYOKKeyGlobalsTypedDict": ".createbyokkey", "CreateBYOKKeyRequest": ".createbyokkey", @@ -2116,6 +2382,14 @@ "CreateKeysResponseTypedDict": ".createkeys", "External": ".createkeys", "ExternalTypedDict": ".createkeys", + "CreateModelAvailabilityPolicyGlobals": ".createmodelavailabilitypolicy", + "CreateModelAvailabilityPolicyGlobalsTypedDict": ".createmodelavailabilitypolicy", + "CreateModelAvailabilityPolicyRequest": ".createmodelavailabilitypolicy", + "CreateModelAvailabilityPolicyRequestTypedDict": ".createmodelavailabilitypolicy", + "CreateModerationPolicyGlobals": ".createmoderationpolicy", + "CreateModerationPolicyGlobalsTypedDict": ".createmoderationpolicy", + "CreateModerationPolicyRequest": ".createmoderationpolicy", + "CreateModerationPolicyRequestTypedDict": ".createmoderationpolicy", "CreateOauthTokenGlobals": ".createoauthtoken", "CreateOauthTokenGlobalsTypedDict": ".createoauthtoken", "CreateOauthTokenRequest": ".createoauthtoken", @@ -2194,10 +2468,18 @@ "CreateWorkspaceGlobalsTypedDict": ".createworkspace", "CreateWorkspaceRequest": ".createworkspace", "CreateWorkspaceRequestTypedDict": ".createworkspace", + "DeleteAccountPolicyGlobals": ".deleteaccountpolicy", + "DeleteAccountPolicyGlobalsTypedDict": ".deleteaccountpolicy", + "DeleteAccountPolicyRequest": ".deleteaccountpolicy", + "DeleteAccountPolicyRequestTypedDict": ".deleteaccountpolicy", "DeleteBatchGlobals": ".deletebatch", "DeleteBatchGlobalsTypedDict": ".deletebatch", "DeleteBatchRequest": ".deletebatch", "DeleteBatchRequestTypedDict": ".deletebatch", + "DeleteBudgetPolicyGlobals": ".deletebudgetpolicy", + "DeleteBudgetPolicyGlobalsTypedDict": ".deletebudgetpolicy", + "DeleteBudgetPolicyRequest": ".deletebudgetpolicy", + "DeleteBudgetPolicyRequestTypedDict": ".deletebudgetpolicy", "DeleteBYOKKeyGlobals": ".deletebyokkey", "DeleteBYOKKeyGlobalsTypedDict": ".deletebyokkey", "DeleteBYOKKeyRequest": ".deletebyokkey", @@ -2224,6 +2506,14 @@ "DeleteKeysRequestTypedDict": ".deletekeys", "DeleteKeysResponse": ".deletekeys", "DeleteKeysResponseTypedDict": ".deletekeys", + "DeleteModelAvailabilityPolicyGlobals": ".deletemodelavailabilitypolicy", + "DeleteModelAvailabilityPolicyGlobalsTypedDict": ".deletemodelavailabilitypolicy", + "DeleteModelAvailabilityPolicyRequest": ".deletemodelavailabilitypolicy", + "DeleteModelAvailabilityPolicyRequestTypedDict": ".deletemodelavailabilitypolicy", + "DeleteModerationPolicyGlobals": ".deletemoderationpolicy", + "DeleteModerationPolicyGlobalsTypedDict": ".deletemoderationpolicy", + "DeleteModerationPolicyRequest": ".deletemoderationpolicy", + "DeleteModerationPolicyRequestTypedDict": ".deletemoderationpolicy", "DeleteObservabilityDestinationGlobals": ".deleteobservabilitydestination", "DeleteObservabilityDestinationGlobalsTypedDict": ".deleteobservabilitydestination", "DeleteObservabilityDestinationRequest": ".deleteobservabilitydestination", @@ -2301,6 +2591,11 @@ "Metric": ".getanalyticsmeta", "MetricTypedDict": ".getanalyticsmeta", "Name": ".getanalyticsmeta", + "GetAPIKeyPolicyAssignmentGlobals": ".getapikeypolicyassignment", + "GetAPIKeyPolicyAssignmentGlobalsTypedDict": ".getapikeypolicyassignment", + "GetAPIKeyPolicyAssignmentPolicyType": ".getapikeypolicyassignment", + "GetAPIKeyPolicyAssignmentRequest": ".getapikeypolicyassignment", + "GetAPIKeyPolicyAssignmentRequestTypedDict": ".getapikeypolicyassignment", "GetAppRankingsCategory": ".getapprankings", "GetAppRankingsGlobals": ".getapprankings", "GetAppRankingsGlobalsTypedDict": ".getapprankings", @@ -2323,6 +2618,10 @@ "SearchSurface": ".getbenchmarks", "Source": ".getbenchmarks", "TaskType": ".getbenchmarks", + "GetBudgetPolicyGlobals": ".getbudgetpolicy", + "GetBudgetPolicyGlobalsTypedDict": ".getbudgetpolicy", + "GetBudgetPolicyRequest": ".getbudgetpolicy", + "GetBudgetPolicyRequestTypedDict": ".getbudgetpolicy", "GetBYOKKeyGlobals": ".getbyokkey", "GetBYOKKeyGlobalsTypedDict": ".getbyokkey", "GetBYOKKeyRequest": ".getbyokkey", @@ -2374,10 +2673,19 @@ "GetKeyRequestTypedDict": ".getkey", "GetKeyResponse": ".getkey", "GetKeyResponseTypedDict": ".getkey", + "GetMemberPolicyAssignmentGlobals": ".getmemberpolicyassignment", + "GetMemberPolicyAssignmentGlobalsTypedDict": ".getmemberpolicyassignment", + "GetMemberPolicyAssignmentPolicyType": ".getmemberpolicyassignment", + "GetMemberPolicyAssignmentRequest": ".getmemberpolicyassignment", + "GetMemberPolicyAssignmentRequestTypedDict": ".getmemberpolicyassignment", "GetModelGlobals": ".getmodel", "GetModelGlobalsTypedDict": ".getmodel", "GetModelRequest": ".getmodel", "GetModelRequestTypedDict": ".getmodel", + "GetModelAvailabilityPolicyGlobals": ".getmodelavailabilitypolicy", + "GetModelAvailabilityPolicyGlobalsTypedDict": ".getmodelavailabilitypolicy", + "GetModelAvailabilityPolicyRequest": ".getmodelavailabilitypolicy", + "GetModelAvailabilityPolicyRequestTypedDict": ".getmodelavailabilitypolicy", "Distillable": ".getmodels", "GetModelsCategory": ".getmodels", "GetModelsGlobals": ".getmodels", @@ -2389,6 +2697,10 @@ "GetModelsSort": ".getmodels", "Region": ".getmodels", "Zdr": ".getmodels", + "GetModerationPolicyGlobals": ".getmoderationpolicy", + "GetModerationPolicyGlobalsTypedDict": ".getmoderationpolicy", + "GetModerationPolicyRequest": ".getmoderationpolicy", + "GetModerationPolicyRequestTypedDict": ".getmoderationpolicy", "GetObservabilityDestinationGlobals": ".getobservabilitydestination", "GetObservabilityDestinationGlobalsTypedDict": ".getobservabilitydestination", "GetObservabilityDestinationRequest": ".getobservabilitydestination", @@ -2481,12 +2793,24 @@ "ListResponseBody": ".list", "ListResponseBodyTypedDict": ".list", "ListResponseTypedDict": ".list", + "ListAccountPoliciesGlobals": ".listaccountpolicies", + "ListAccountPoliciesGlobalsTypedDict": ".listaccountpolicies", + "ListAccountPoliciesRequest": ".listaccountpolicies", + "ListAccountPoliciesRequestTypedDict": ".listaccountpolicies", + "ListAccountPoliciesResponse": ".listaccountpolicies", + "ListAccountPoliciesResponseTypedDict": ".listaccountpolicies", "ListBatchesGlobals": ".listbatches", "ListBatchesGlobalsTypedDict": ".listbatches", "ListBatchesRequest": ".listbatches", "ListBatchesRequestTypedDict": ".listbatches", "ListBatchesResponse": ".listbatches", "ListBatchesResponseTypedDict": ".listbatches", + "ListBudgetPoliciesGlobals": ".listbudgetpolicies", + "ListBudgetPoliciesGlobalsTypedDict": ".listbudgetpolicies", + "ListBudgetPoliciesRequest": ".listbudgetpolicies", + "ListBudgetPoliciesRequestTypedDict": ".listbudgetpolicies", + "ListBudgetPoliciesResponse": ".listbudgetpolicies", + "ListBudgetPoliciesResponseTypedDict": ".listbudgetpolicies", "ListBYOKKeysGlobals": ".listbyokkeys", "ListBYOKKeysGlobalsTypedDict": ".listbyokkeys", "ListBYOKKeysRequest": ".listbyokkeys", @@ -2587,6 +2911,12 @@ "ListMemberAssignmentsRequestTypedDict": ".listmemberassignments", "ListMemberAssignmentsResponse": ".listmemberassignments", "ListMemberAssignmentsResponseTypedDict": ".listmemberassignments", + "ListModelAvailabilityPoliciesGlobals": ".listmodelavailabilitypolicies", + "ListModelAvailabilityPoliciesGlobalsTypedDict": ".listmodelavailabilitypolicies", + "ListModelAvailabilityPoliciesRequest": ".listmodelavailabilitypolicies", + "ListModelAvailabilityPoliciesRequestTypedDict": ".listmodelavailabilitypolicies", + "ListModelAvailabilityPoliciesResponse": ".listmodelavailabilitypolicies", + "ListModelAvailabilityPoliciesResponseTypedDict": ".listmodelavailabilitypolicies", "ListModelsCountGlobals": ".listmodelscount", "ListModelsCountGlobalsTypedDict": ".listmodelscount", "ListModelsCountRequest": ".listmodelscount", @@ -2601,6 +2931,12 @@ "ListModelsUserSecurity": ".listmodelsuser", "ListModelsUserSecurityTypedDict": ".listmodelsuser", "ListModelsUserSort": ".listmodelsuser", + "ListModerationPoliciesGlobals": ".listmoderationpolicies", + "ListModerationPoliciesGlobalsTypedDict": ".listmoderationpolicies", + "ListModerationPoliciesRequest": ".listmoderationpolicies", + "ListModerationPoliciesRequestTypedDict": ".listmoderationpolicies", + "ListModerationPoliciesResponse": ".listmoderationpolicies", + "ListModerationPoliciesResponseTypedDict": ".listmoderationpolicies", "ListOauthJwksGlobals": ".listoauthjwks", "ListOauthJwksGlobalsTypedDict": ".listoauthjwks", "ListOauthJwksRequest": ".listoauthjwks", @@ -2746,6 +3082,14 @@ "SubmitGenerationFeedbackGlobalsTypedDict": ".submitgenerationfeedback", "SubmitGenerationFeedbackRequest": ".submitgenerationfeedback", "SubmitGenerationFeedbackRequestTypedDict": ".submitgenerationfeedback", + "UpdateAccountPolicyGlobals": ".updateaccountpolicy", + "UpdateAccountPolicyGlobalsTypedDict": ".updateaccountpolicy", + "UpdateAccountPolicyRequest": ".updateaccountpolicy", + "UpdateAccountPolicyRequestTypedDict": ".updateaccountpolicy", + "UpdateBudgetPolicyGlobals": ".updatebudgetpolicy", + "UpdateBudgetPolicyGlobalsTypedDict": ".updatebudgetpolicy", + "UpdateBudgetPolicyRequest": ".updatebudgetpolicy", + "UpdateBudgetPolicyRequestTypedDict": ".updatebudgetpolicy", "UpdateBYOKKeyGlobals": ".updatebyokkey", "UpdateBYOKKeyGlobalsTypedDict": ".updatebyokkey", "UpdateBYOKKeyRequest": ".updatebyokkey", @@ -2769,6 +3113,14 @@ "UpdateKeysRequestTypedDict": ".updatekeys", "UpdateKeysResponse": ".updatekeys", "UpdateKeysResponseTypedDict": ".updatekeys", + "UpdateModelAvailabilityPolicyGlobals": ".updatemodelavailabilitypolicy", + "UpdateModelAvailabilityPolicyGlobalsTypedDict": ".updatemodelavailabilitypolicy", + "UpdateModelAvailabilityPolicyRequest": ".updatemodelavailabilitypolicy", + "UpdateModelAvailabilityPolicyRequestTypedDict": ".updatemodelavailabilitypolicy", + "UpdateModerationPolicyGlobals": ".updatemoderationpolicy", + "UpdateModerationPolicyGlobalsTypedDict": ".updatemoderationpolicy", + "UpdateModerationPolicyRequest": ".updatemoderationpolicy", + "UpdateModerationPolicyRequestTypedDict": ".updatemoderationpolicy", "UpdateObservabilityDestinationGlobals": ".updateobservabilitydestination", "UpdateObservabilityDestinationGlobalsTypedDict": ".updateobservabilitydestination", "UpdateObservabilityDestinationRequest": ".updateobservabilitydestination", diff --git a/src/openrouter/operations/changeapikeypolicyassignment.py b/src/openrouter/operations/changeapikeypolicyassignment.py new file mode 100644 index 000000000..fd3bca20d --- /dev/null +++ b/src/openrouter/operations/changeapikeypolicyassignment.py @@ -0,0 +1,158 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + changeguardrailpolicyassignmentrequest as components_changeguardrailpolicyassignmentrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ChangeAPIKeyPolicyAssignmentGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ChangeAPIKeyPolicyAssignmentGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ChangeAPIKeyPolicyAssignmentRequestTypedDict(TypedDict): + hash: str + r"""API key hash""" + change_guardrail_policy_assignment_request: components_changeguardrailpolicyassignmentrequest.ChangeGuardrailPolicyAssignmentRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ChangeAPIKeyPolicyAssignmentRequest(BaseModel): + hash: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""API key hash""" + + change_guardrail_policy_assignment_request: Annotated[ + components_changeguardrailpolicyassignmentrequest.ChangeGuardrailPolicyAssignmentRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/changememberpolicyassignment.py b/src/openrouter/operations/changememberpolicyassignment.py new file mode 100644 index 000000000..87a88920e --- /dev/null +++ b/src/openrouter/operations/changememberpolicyassignment.py @@ -0,0 +1,158 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + changeguardrailpolicyassignmentrequest as components_changeguardrailpolicyassignmentrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ChangeMemberPolicyAssignmentGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ChangeMemberPolicyAssignmentGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ChangeMemberPolicyAssignmentRequestTypedDict(TypedDict): + member_id: str + r"""Organization member user ID""" + change_guardrail_policy_assignment_request: components_changeguardrailpolicyassignmentrequest.ChangeGuardrailPolicyAssignmentRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ChangeMemberPolicyAssignmentRequest(BaseModel): + member_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Organization member user ID""" + + change_guardrail_policy_assignment_request: Annotated[ + components_changeguardrailpolicyassignmentrequest.ChangeGuardrailPolicyAssignmentRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/createaccountpolicy.py b/src/openrouter/operations/createaccountpolicy.py new file mode 100644 index 000000000..bf40dd5e5 --- /dev/null +++ b/src/openrouter/operations/createaccountpolicy.py @@ -0,0 +1,148 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + accountguardrailpolicyrequest as components_accountguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateAccountPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateAccountPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreateAccountPolicyRequestTypedDict(TypedDict): + account_guardrail_policy_request: ( + components_accountguardrailpolicyrequest.AccountGuardrailPolicyRequestTypedDict + ) + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateAccountPolicyRequest(BaseModel): + account_guardrail_policy_request: Annotated[ + components_accountguardrailpolicyrequest.AccountGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/createbudgetpolicy.py b/src/openrouter/operations/createbudgetpolicy.py new file mode 100644 index 000000000..e728e6e07 --- /dev/null +++ b/src/openrouter/operations/createbudgetpolicy.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + createbudgetguardrailpolicyrequest as components_createbudgetguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateBudgetPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateBudgetPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreateBudgetPolicyRequestTypedDict(TypedDict): + create_budget_guardrail_policy_request: components_createbudgetguardrailpolicyrequest.CreateBudgetGuardrailPolicyRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateBudgetPolicyRequest(BaseModel): + create_budget_guardrail_policy_request: Annotated[ + components_createbudgetguardrailpolicyrequest.CreateBudgetGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/createmodelavailabilitypolicy.py b/src/openrouter/operations/createmodelavailabilitypolicy.py new file mode 100644 index 000000000..63ffd7729 --- /dev/null +++ b/src/openrouter/operations/createmodelavailabilitypolicy.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + createmodelavailabilityguardrailpolicyrequest as components_createmodelavailabilityguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateModelAvailabilityPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateModelAvailabilityPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreateModelAvailabilityPolicyRequestTypedDict(TypedDict): + create_model_availability_guardrail_policy_request: components_createmodelavailabilityguardrailpolicyrequest.CreateModelAvailabilityGuardrailPolicyRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateModelAvailabilityPolicyRequest(BaseModel): + create_model_availability_guardrail_policy_request: Annotated[ + components_createmodelavailabilityguardrailpolicyrequest.CreateModelAvailabilityGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/createmoderationpolicy.py b/src/openrouter/operations/createmoderationpolicy.py new file mode 100644 index 000000000..670af38e3 --- /dev/null +++ b/src/openrouter/operations/createmoderationpolicy.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + createmoderationguardrailpolicyrequest as components_createmoderationguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateModerationPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateModerationPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreateModerationPolicyRequestTypedDict(TypedDict): + create_moderation_guardrail_policy_request: components_createmoderationguardrailpolicyrequest.CreateModerationGuardrailPolicyRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class CreateModerationPolicyRequest(BaseModel): + create_moderation_guardrail_policy_request: Annotated[ + components_createmoderationguardrailpolicyrequest.CreateModerationGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/deleteaccountpolicy.py b/src/openrouter/operations/deleteaccountpolicy.py new file mode 100644 index 000000000..0228ab458 --- /dev/null +++ b/src/openrouter/operations/deleteaccountpolicy.py @@ -0,0 +1,144 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteAccountPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteAccountPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteAccountPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteAccountPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/deletebudgetpolicy.py b/src/openrouter/operations/deletebudgetpolicy.py new file mode 100644 index 000000000..90fd1f9ef --- /dev/null +++ b/src/openrouter/operations/deletebudgetpolicy.py @@ -0,0 +1,156 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteBudgetPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteBudgetPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteBudgetPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteBudgetPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/deletemodelavailabilitypolicy.py b/src/openrouter/operations/deletemodelavailabilitypolicy.py new file mode 100644 index 000000000..3827862e2 --- /dev/null +++ b/src/openrouter/operations/deletemodelavailabilitypolicy.py @@ -0,0 +1,156 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteModelAvailabilityPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteModelAvailabilityPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteModelAvailabilityPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteModelAvailabilityPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/deletemoderationpolicy.py b/src/openrouter/operations/deletemoderationpolicy.py new file mode 100644 index 000000000..481cb406c --- /dev/null +++ b/src/openrouter/operations/deletemoderationpolicy.py @@ -0,0 +1,156 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteModerationPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteModerationPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteModerationPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteModerationPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/getapikeypolicyassignment.py b/src/openrouter/operations/getapikeypolicyassignment.py new file mode 100644 index 000000000..7b87d4d54 --- /dev/null +++ b/src/openrouter/operations/getapikeypolicyassignment.py @@ -0,0 +1,176 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetAPIKeyPolicyAssignmentGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetAPIKeyPolicyAssignmentGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetAPIKeyPolicyAssignmentPolicyType = Union[ + Literal[ + "budget", + "model_availability", + "moderation", + "rate_limit", + ], + UnrecognizedStr, +] +r"""Policy type the assignment is read or changed for""" + + +class GetAPIKeyPolicyAssignmentRequestTypedDict(TypedDict): + hash: str + r"""API key hash""" + workspace_id: str + r"""Workspace the policy belongs to""" + policy_type: GetAPIKeyPolicyAssignmentPolicyType + r"""Policy type the assignment is read or changed for""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetAPIKeyPolicyAssignmentRequest(BaseModel): + hash: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""API key hash""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + policy_type: Annotated[ + GetAPIKeyPolicyAssignmentPolicyType, + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Policy type the assignment is read or changed for""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/getbudgetpolicy.py b/src/openrouter/operations/getbudgetpolicy.py new file mode 100644 index 000000000..5d830347d --- /dev/null +++ b/src/openrouter/operations/getbudgetpolicy.py @@ -0,0 +1,156 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetBudgetPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetBudgetPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetBudgetPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetBudgetPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/getmemberpolicyassignment.py b/src/openrouter/operations/getmemberpolicyassignment.py new file mode 100644 index 000000000..c48504773 --- /dev/null +++ b/src/openrouter/operations/getmemberpolicyassignment.py @@ -0,0 +1,176 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetMemberPolicyAssignmentGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetMemberPolicyAssignmentGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetMemberPolicyAssignmentPolicyType = Union[ + Literal[ + "budget", + "model_availability", + "moderation", + "rate_limit", + ], + UnrecognizedStr, +] +r"""Policy type the assignment is read or changed for""" + + +class GetMemberPolicyAssignmentRequestTypedDict(TypedDict): + member_id: str + r"""Organization member user ID""" + workspace_id: str + r"""Workspace the policy belongs to""" + policy_type: GetMemberPolicyAssignmentPolicyType + r"""Policy type the assignment is read or changed for""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetMemberPolicyAssignmentRequest(BaseModel): + member_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Organization member user ID""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + policy_type: Annotated[ + GetMemberPolicyAssignmentPolicyType, + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Policy type the assignment is read or changed for""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/getmodelavailabilitypolicy.py b/src/openrouter/operations/getmodelavailabilitypolicy.py new file mode 100644 index 000000000..5a3c822a8 --- /dev/null +++ b/src/openrouter/operations/getmodelavailabilitypolicy.py @@ -0,0 +1,156 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetModelAvailabilityPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetModelAvailabilityPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetModelAvailabilityPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetModelAvailabilityPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/getmoderationpolicy.py b/src/openrouter/operations/getmoderationpolicy.py new file mode 100644 index 000000000..9e1e83005 --- /dev/null +++ b/src/openrouter/operations/getmoderationpolicy.py @@ -0,0 +1,156 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetModerationPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetModerationPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetModerationPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetModerationPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/listaccountpolicies.py b/src/openrouter/operations/listaccountpolicies.py new file mode 100644 index 000000000..1d150e3dc --- /dev/null +++ b/src/openrouter/operations/listaccountpolicies.py @@ -0,0 +1,175 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + listaccountguardrailpoliciesresponse as components_listaccountguardrailpoliciesresponse, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Awaitable, Callable, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListAccountPoliciesGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListAccountPoliciesGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListAccountPoliciesRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + offset: NotRequired[int] + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + limit: NotRequired[int] + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + +class ListAccountPoliciesRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + offset: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListAccountPoliciesResponseTypedDict(TypedDict): + result: components_listaccountguardrailpoliciesresponse.ListAccountGuardrailPoliciesResponseTypedDict + + +class ListAccountPoliciesResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListAccountPoliciesResponse]], + Callable[[], Awaitable[Optional[ListAccountPoliciesResponse]]], + ] + + result: components_listaccountguardrailpoliciesresponse.ListAccountGuardrailPoliciesResponse diff --git a/src/openrouter/operations/listbudgetpolicies.py b/src/openrouter/operations/listbudgetpolicies.py new file mode 100644 index 000000000..cb0680de6 --- /dev/null +++ b/src/openrouter/operations/listbudgetpolicies.py @@ -0,0 +1,182 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + listbudgetguardrailpoliciesresponse as components_listbudgetguardrailpoliciesresponse, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Awaitable, Callable, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListBudgetPoliciesGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListBudgetPoliciesGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListBudgetPoliciesRequestTypedDict(TypedDict): + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + offset: NotRequired[int] + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + limit: NotRequired[int] + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + +class ListBudgetPoliciesRequest(BaseModel): + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + offset: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListBudgetPoliciesResponseTypedDict(TypedDict): + result: components_listbudgetguardrailpoliciesresponse.ListBudgetGuardrailPoliciesResponseTypedDict + + +class ListBudgetPoliciesResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListBudgetPoliciesResponse]], + Callable[[], Awaitable[Optional[ListBudgetPoliciesResponse]]], + ] + + result: components_listbudgetguardrailpoliciesresponse.ListBudgetGuardrailPoliciesResponse diff --git a/src/openrouter/operations/listmodelavailabilitypolicies.py b/src/openrouter/operations/listmodelavailabilitypolicies.py new file mode 100644 index 000000000..dac3be4a1 --- /dev/null +++ b/src/openrouter/operations/listmodelavailabilitypolicies.py @@ -0,0 +1,182 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + listmodelavailabilityguardrailpoliciesresponse as components_listmodelavailabilityguardrailpoliciesresponse, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Awaitable, Callable, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListModelAvailabilityPoliciesGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListModelAvailabilityPoliciesGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListModelAvailabilityPoliciesRequestTypedDict(TypedDict): + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + offset: NotRequired[int] + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + limit: NotRequired[int] + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + +class ListModelAvailabilityPoliciesRequest(BaseModel): + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + offset: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListModelAvailabilityPoliciesResponseTypedDict(TypedDict): + result: components_listmodelavailabilityguardrailpoliciesresponse.ListModelAvailabilityGuardrailPoliciesResponseTypedDict + + +class ListModelAvailabilityPoliciesResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListModelAvailabilityPoliciesResponse]], + Callable[[], Awaitable[Optional[ListModelAvailabilityPoliciesResponse]]], + ] + + result: components_listmodelavailabilityguardrailpoliciesresponse.ListModelAvailabilityGuardrailPoliciesResponse diff --git a/src/openrouter/operations/listmoderationpolicies.py b/src/openrouter/operations/listmoderationpolicies.py new file mode 100644 index 000000000..d5419d4b5 --- /dev/null +++ b/src/openrouter/operations/listmoderationpolicies.py @@ -0,0 +1,182 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + listmoderationguardrailpoliciesresponse as components_listmoderationguardrailpoliciesresponse, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Awaitable, Callable, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListModerationPoliciesGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListModerationPoliciesGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListModerationPoliciesRequestTypedDict(TypedDict): + workspace_id: str + r"""Workspace the policy belongs to""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + offset: NotRequired[int] + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + limit: NotRequired[int] + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + +class ListModerationPoliciesRequest(BaseModel): + workspace_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Workspace the policy belongs to""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + offset: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListModerationPoliciesResponseTypedDict(TypedDict): + result: components_listmoderationguardrailpoliciesresponse.ListModerationGuardrailPoliciesResponseTypedDict + + +class ListModerationPoliciesResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListModerationPoliciesResponse]], + Callable[[], Awaitable[Optional[ListModerationPoliciesResponse]]], + ] + + result: components_listmoderationguardrailpoliciesresponse.ListModerationGuardrailPoliciesResponse diff --git a/src/openrouter/operations/updateaccountpolicy.py b/src/openrouter/operations/updateaccountpolicy.py new file mode 100644 index 000000000..6a2bf49a1 --- /dev/null +++ b/src/openrouter/operations/updateaccountpolicy.py @@ -0,0 +1,160 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + accountguardrailpolicyrequest as components_accountguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateAccountPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateAccountPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdateAccountPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + account_guardrail_policy_request: ( + components_accountguardrailpolicyrequest.AccountGuardrailPolicyRequestTypedDict + ) + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateAccountPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + account_guardrail_policy_request: Annotated[ + components_accountguardrailpolicyrequest.AccountGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/updatebudgetpolicy.py b/src/openrouter/operations/updatebudgetpolicy.py new file mode 100644 index 000000000..bc949624f --- /dev/null +++ b/src/openrouter/operations/updatebudgetpolicy.py @@ -0,0 +1,158 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + updatebudgetguardrailpolicyrequest as components_updatebudgetguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateBudgetPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateBudgetPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdateBudgetPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + update_budget_guardrail_policy_request: components_updatebudgetguardrailpolicyrequest.UpdateBudgetGuardrailPolicyRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateBudgetPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + update_budget_guardrail_policy_request: Annotated[ + components_updatebudgetguardrailpolicyrequest.UpdateBudgetGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/updatemodelavailabilitypolicy.py b/src/openrouter/operations/updatemodelavailabilitypolicy.py new file mode 100644 index 000000000..12688403a --- /dev/null +++ b/src/openrouter/operations/updatemodelavailabilitypolicy.py @@ -0,0 +1,158 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + updatemodelavailabilityguardrailpolicyrequest as components_updatemodelavailabilityguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateModelAvailabilityPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateModelAvailabilityPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdateModelAvailabilityPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + update_model_availability_guardrail_policy_request: components_updatemodelavailabilityguardrailpolicyrequest.UpdateModelAvailabilityGuardrailPolicyRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateModelAvailabilityPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + update_model_availability_guardrail_policy_request: Annotated[ + components_updatemodelavailabilityguardrailpolicyrequest.UpdateModelAvailabilityGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/updatemoderationpolicy.py b/src/openrouter/operations/updatemoderationpolicy.py new file mode 100644 index 000000000..043d2ced3 --- /dev/null +++ b/src/openrouter/operations/updatemoderationpolicy.py @@ -0,0 +1,158 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + updatemoderationguardrailpolicyrequest as components_updatemoderationguardrailpolicyrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateModerationPolicyGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateModerationPolicyGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdateModerationPolicyRequestTypedDict(TypedDict): + id: str + r"""Policy ID""" + update_moderation_guardrail_policy_request: components_updatemoderationguardrailpolicyrequest.UpdateModerationGuardrailPolicyRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateModerationPolicyRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Policy ID""" + + update_moderation_guardrail_policy_request: Annotated[ + components_updatemoderationguardrailpolicyrequest.UpdateModerationGuardrailPolicyRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index 5be8b45ed..a015bc43a 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -33,6 +33,7 @@ from openrouter.externalusers import ExternalUsers from openrouter.files import Files from openrouter.generations import Generations + from openrouter.guardrail_policies import GuardrailPolicies from openrouter.guardrails import Guardrails from openrouter.images import Images from openrouter.models_ import Models @@ -95,6 +96,8 @@ class OpenRouter(BaseSDK): r"""Generation history endpoints""" guardrails: "Guardrails" r"""Guardrails endpoints""" + guardrail_policies: "GuardrailPolicies" + r"""Guardrail Policies endpoints""" images: "Images" r"""Images endpoints""" api_keys: "APIKeys" @@ -150,6 +153,7 @@ class OpenRouter(BaseSDK): "files": ("openrouter.files", "Files"), "generations": ("openrouter.generations", "Generations"), "guardrails": ("openrouter.guardrails", "Guardrails"), + "guardrail_policies": ("openrouter.guardrail_policies", "GuardrailPolicies"), "images": ("openrouter.images", "Images"), "api_keys": ("openrouter.api_keys", "APIKeys"), "models": ("openrouter.models_", "Models"), diff --git a/uv.lock b/uv.lock index 82d077b38..73298bb80 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.132" +version = "1.3.133" source = { editable = "." } dependencies = [ { name = "httpcore" }, From eb45ac5d442c2d06a064a45c25bb89a3c9ab3a6a Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Fri, 6 Nov 2026 00:51:47 +0000 Subject: [PATCH 2/3] empty commit to trigger [run-tests] workflow From a8d6e32beb555edd7033020f2494031ad713d813 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 6 Nov 2026 00:52:01 +0000 Subject: [PATCH 3/3] Chore: regenerate docs navigation Auto-generated-by: update-generated-files-action; https://github.com/OpenRouterTeam/python-sdk/actions/runs/42139876068 --- docs/docs.json | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs.json b/docs/docs.json index d7e14135b..c339544fd 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -28,6 +28,7 @@ "sdks/extractions/README", "sdks/files/README", "sdks/generations/README", + "sdks/guardrailpolicies/README", "sdks/guardrails/README", "sdks/images/README", "sdks/models/README",