pub struct ManagementClient<'a> { /* private fields */ }Expand description
Domain client for management endpoints.
Implementations§
Source§impl<'a> ManagementClient<'a>
impl<'a> ManagementClient<'a>
Sourcepub async fn create_api_key(
&self,
name: &str,
limit: Option<f64>,
) -> Result<ApiKey, OpenRouterError>
pub async fn create_api_key( &self, name: &str, limit: Option<f64>, ) -> Result<ApiKey, OpenRouterError>
Create a managed API key (POST /keys).
Sourcepub async fn create_api_key_in_workspace(
&self,
name: &str,
limit: Option<f64>,
workspace_id: Option<&str>,
) -> Result<ApiKey, OpenRouterError>
pub async fn create_api_key_in_workspace( &self, name: &str, limit: Option<f64>, workspace_id: Option<&str>, ) -> Result<ApiKey, OpenRouterError>
Create a managed API key in a workspace (POST /keys).
Sourcepub async fn get_current_api_key_info(
&self,
) -> Result<ApiKeyDetails, OpenRouterError>
pub async fn get_current_api_key_info( &self, ) -> Result<ApiKeyDetails, OpenRouterError>
Get current key session info (GET /key).
Sourcepub async fn create_chat_completion_preset(
&self,
slug: &str,
request: &ChatCompletionRequest,
) -> Result<PresetWithDesignatedVersion, OpenRouterError>
pub async fn create_chat_completion_preset( &self, slug: &str, request: &ChatCompletionRequest, ) -> Result<PresetWithDesignatedVersion, OpenRouterError>
Create or update a preset from a chat-completions request body.
Sourcepub async fn create_response_preset(
&self,
slug: &str,
request: &ResponsesRequest,
) -> Result<PresetWithDesignatedVersion, OpenRouterError>
pub async fn create_response_preset( &self, slug: &str, request: &ResponsesRequest, ) -> Result<PresetWithDesignatedVersion, OpenRouterError>
Create or update a preset from a Responses API request body.
Sourcepub async fn create_message_preset(
&self,
slug: &str,
request: &AnthropicMessagesRequest,
) -> Result<PresetWithDesignatedVersion, OpenRouterError>
pub async fn create_message_preset( &self, slug: &str, request: &AnthropicMessagesRequest, ) -> Result<PresetWithDesignatedVersion, OpenRouterError>
Create or update a preset from an Anthropic-compatible Messages request body.
Sourcepub async fn list_presets(
&self,
pagination: Option<PaginationOptions>,
) -> Result<ListPresetsResponse, OpenRouterError>
pub async fn list_presets( &self, pagination: Option<PaginationOptions>, ) -> Result<ListPresetsResponse, OpenRouterError>
List presets (GET /presets).
Sourcepub async fn get_preset(
&self,
slug: &str,
) -> Result<PresetWithDesignatedVersion, OpenRouterError>
pub async fn get_preset( &self, slug: &str, ) -> Result<PresetWithDesignatedVersion, OpenRouterError>
Get one preset (GET /presets/{slug}).
Sourcepub async fn list_preset_versions(
&self,
slug: &str,
pagination: Option<PaginationOptions>,
) -> Result<ListPresetVersionsResponse, OpenRouterError>
pub async fn list_preset_versions( &self, slug: &str, pagination: Option<PaginationOptions>, ) -> Result<ListPresetVersionsResponse, OpenRouterError>
List preset versions (GET /presets/{slug}/versions).
Sourcepub async fn get_preset_version(
&self,
slug: &str,
version: &str,
) -> Result<PresetDesignatedVersion, OpenRouterError>
pub async fn get_preset_version( &self, slug: &str, version: &str, ) -> Result<PresetDesignatedVersion, OpenRouterError>
Get a preset version (GET /presets/{slug}/versions/{version}).
Sourcepub async fn delete_api_key(&self, hash: &str) -> Result<bool, OpenRouterError>
pub async fn delete_api_key(&self, hash: &str) -> Result<bool, OpenRouterError>
Delete an API key (DELETE /keys/{hash}).
Sourcepub async fn update_api_key(
&self,
hash: &str,
name: Option<String>,
disabled: Option<bool>,
limit: Option<f64>,
) -> Result<ApiKey, OpenRouterError>
pub async fn update_api_key( &self, hash: &str, name: Option<String>, disabled: Option<bool>, limit: Option<f64>, ) -> Result<ApiKey, OpenRouterError>
Update an API key (PATCH /keys/{hash}).
Sourcepub async fn list_api_keys(
&self,
pagination: Option<PaginationOptions>,
include_disabled: Option<bool>,
) -> Result<Vec<ApiKey>, OpenRouterError>
pub async fn list_api_keys( &self, pagination: Option<PaginationOptions>, include_disabled: Option<bool>, ) -> Result<Vec<ApiKey>, OpenRouterError>
List API keys (GET /keys).
Sourcepub async fn list_api_keys_in_workspace(
&self,
pagination: Option<PaginationOptions>,
include_disabled: Option<bool>,
workspace_id: Option<&str>,
) -> Result<Vec<ApiKey>, OpenRouterError>
pub async fn list_api_keys_in_workspace( &self, pagination: Option<PaginationOptions>, include_disabled: Option<bool>, workspace_id: Option<&str>, ) -> Result<Vec<ApiKey>, OpenRouterError>
List API keys scoped to a workspace (GET /keys?workspace_id=...).
Sourcepub async fn get_api_key(&self, hash: &str) -> Result<ApiKey, OpenRouterError>
pub async fn get_api_key(&self, hash: &str) -> Result<ApiKey, OpenRouterError>
Get an API key (GET /keys/{hash}).
Sourcepub async fn create_auth_code(
&self,
request: &CreateAuthCodeRequest,
) -> Result<AuthCodeData, OpenRouterError>
pub async fn create_auth_code( &self, request: &CreateAuthCodeRequest, ) -> Result<AuthCodeData, OpenRouterError>
Create OAuth auth code (POST /auth/keys/code).
Sourcepub async fn create_api_key_from_auth_code(
&self,
code: &str,
code_verifier: Option<&str>,
code_challenge_method: Option<CodeChallengeMethod>,
) -> Result<AuthResponse, OpenRouterError>
pub async fn create_api_key_from_auth_code( &self, code: &str, code_verifier: Option<&str>, code_challenge_method: Option<CodeChallengeMethod>, ) -> Result<AuthResponse, OpenRouterError>
Create an API key from auth code (POST /auth/keys).
Sourcepub async fn create_coinbase_charge(
&self,
request: &CoinbaseChargeRequest,
) -> Result<CoinbaseChargeData, OpenRouterError>
pub async fn create_coinbase_charge( &self, request: &CoinbaseChargeRequest, ) -> Result<CoinbaseChargeData, OpenRouterError>
Create a Coinbase charge (POST /credits/coinbase).
Sourcepub async fn get_credits(&self) -> Result<CreditsData, OpenRouterError>
pub async fn get_credits(&self) -> Result<CreditsData, OpenRouterError>
Get credits (GET /credits).
Sourcepub async fn get_generation(
&self,
id: impl Into<String>,
) -> Result<GenerationData, OpenRouterError>
pub async fn get_generation( &self, id: impl Into<String>, ) -> Result<GenerationData, OpenRouterError>
Get generation metadata (GET /generation?id=...).
Sourcepub async fn get_generation_content(
&self,
id: impl Into<String>,
) -> Result<GenerationContentData, OpenRouterError>
pub async fn get_generation_content( &self, id: impl Into<String>, ) -> Result<GenerationContentData, OpenRouterError>
Get stored generation content (GET /generation/content?id=...).
Sourcepub async fn get_activity(
&self,
date: Option<&str>,
) -> Result<Vec<ActivityItem>, OpenRouterError>
pub async fn get_activity( &self, date: Option<&str>, ) -> Result<Vec<ActivityItem>, OpenRouterError>
Get endpoint usage activity (GET /activity).
Sourcepub async fn get_analytics_meta(&self) -> Result<AnalyticsMeta, OpenRouterError>
pub async fn get_analytics_meta(&self) -> Result<AnalyticsMeta, OpenRouterError>
Get analytics metadata (GET /analytics/meta).
Sourcepub async fn query_analytics(
&self,
request: &AnalyticsQueryRequest,
) -> Result<AnalyticsQueryResponse, OpenRouterError>
pub async fn query_analytics( &self, request: &AnalyticsQueryRequest, ) -> Result<AnalyticsQueryResponse, OpenRouterError>
Query analytics (POST /analytics/query).
Sourcepub async fn list_byok_keys(
&self,
pagination: Option<PaginationOptions>,
workspace_id: Option<&str>,
provider: Option<&str>,
) -> Result<ByokKeyListResponse, OpenRouterError>
pub async fn list_byok_keys( &self, pagination: Option<PaginationOptions>, workspace_id: Option<&str>, provider: Option<&str>, ) -> Result<ByokKeyListResponse, OpenRouterError>
List BYOK provider credentials (GET /byok).
Sourcepub async fn create_byok_key(
&self,
request: &CreateByokKeyRequest,
) -> Result<ByokKey, OpenRouterError>
pub async fn create_byok_key( &self, request: &CreateByokKeyRequest, ) -> Result<ByokKey, OpenRouterError>
Create a BYOK provider credential (POST /byok).
Sourcepub async fn get_byok_key(&self, id: &str) -> Result<ByokKey, OpenRouterError>
pub async fn get_byok_key(&self, id: &str) -> Result<ByokKey, OpenRouterError>
Get a BYOK provider credential (GET /byok/{id}).
Sourcepub async fn update_byok_key(
&self,
id: &str,
request: &UpdateByokKeyRequest,
) -> Result<ByokKey, OpenRouterError>
pub async fn update_byok_key( &self, id: &str, request: &UpdateByokKeyRequest, ) -> Result<ByokKey, OpenRouterError>
Update a BYOK provider credential (PATCH /byok/{id}).
Sourcepub async fn delete_byok_key(&self, id: &str) -> Result<bool, OpenRouterError>
pub async fn delete_byok_key(&self, id: &str) -> Result<bool, OpenRouterError>
Delete a BYOK provider credential (DELETE /byok/{id}).
Sourcepub async fn list_observability_destinations(
&self,
pagination: Option<PaginationOptions>,
workspace_id: Option<&str>,
) -> Result<ObservabilityDestinationListResponse, OpenRouterError>
pub async fn list_observability_destinations( &self, pagination: Option<PaginationOptions>, workspace_id: Option<&str>, ) -> Result<ObservabilityDestinationListResponse, OpenRouterError>
List observability destinations (GET /observability/destinations).
Sourcepub async fn create_observability_destination(
&self,
request: &CreateObservabilityDestinationRequest,
) -> Result<ObservabilityDestination, OpenRouterError>
pub async fn create_observability_destination( &self, request: &CreateObservabilityDestinationRequest, ) -> Result<ObservabilityDestination, OpenRouterError>
Create an observability destination (POST /observability/destinations).
Sourcepub async fn get_observability_destination(
&self,
id: &str,
) -> Result<ObservabilityDestination, OpenRouterError>
pub async fn get_observability_destination( &self, id: &str, ) -> Result<ObservabilityDestination, OpenRouterError>
Get an observability destination (GET /observability/destinations/{id}).
Sourcepub async fn update_observability_destination(
&self,
id: &str,
request: &UpdateObservabilityDestinationRequest,
) -> Result<ObservabilityDestination, OpenRouterError>
pub async fn update_observability_destination( &self, id: &str, request: &UpdateObservabilityDestinationRequest, ) -> Result<ObservabilityDestination, OpenRouterError>
Update an observability destination (PATCH /observability/destinations/{id}).
Sourcepub async fn delete_observability_destination(
&self,
id: &str,
) -> Result<bool, OpenRouterError>
pub async fn delete_observability_destination( &self, id: &str, ) -> Result<bool, OpenRouterError>
Delete an observability destination (DELETE /observability/destinations/{id}).
Sourcepub async fn list_guardrails(
&self,
pagination: Option<PaginationOptions>,
) -> Result<GuardrailListResponse, OpenRouterError>
pub async fn list_guardrails( &self, pagination: Option<PaginationOptions>, ) -> Result<GuardrailListResponse, OpenRouterError>
List guardrails (GET /guardrails).
Sourcepub async fn list_guardrails_in_workspace(
&self,
pagination: Option<PaginationOptions>,
workspace_id: Option<&str>,
) -> Result<GuardrailListResponse, OpenRouterError>
pub async fn list_guardrails_in_workspace( &self, pagination: Option<PaginationOptions>, workspace_id: Option<&str>, ) -> Result<GuardrailListResponse, OpenRouterError>
List guardrails scoped to a workspace (GET /guardrails?workspace_id=...).
Sourcepub async fn create_guardrail(
&self,
request: &CreateGuardrailRequest,
) -> Result<Guardrail, OpenRouterError>
pub async fn create_guardrail( &self, request: &CreateGuardrailRequest, ) -> Result<Guardrail, OpenRouterError>
Create a guardrail (POST /guardrails).
Sourcepub async fn get_guardrail(
&self,
id: &str,
) -> Result<Guardrail, OpenRouterError>
pub async fn get_guardrail( &self, id: &str, ) -> Result<Guardrail, OpenRouterError>
Get a guardrail (GET /guardrails/{id}).
Sourcepub async fn update_guardrail(
&self,
id: &str,
request: &UpdateGuardrailRequest,
) -> Result<Guardrail, OpenRouterError>
pub async fn update_guardrail( &self, id: &str, request: &UpdateGuardrailRequest, ) -> Result<Guardrail, OpenRouterError>
Update a guardrail (PATCH /guardrails/{id}).
Sourcepub async fn delete_guardrail(&self, id: &str) -> Result<bool, OpenRouterError>
pub async fn delete_guardrail(&self, id: &str) -> Result<bool, OpenRouterError>
Delete a guardrail (DELETE /guardrails/{id}).
Sourcepub async fn list_guardrail_key_assignments(
&self,
id: &str,
pagination: Option<PaginationOptions>,
) -> Result<GuardrailKeyAssignmentsResponse, OpenRouterError>
pub async fn list_guardrail_key_assignments( &self, id: &str, pagination: Option<PaginationOptions>, ) -> Result<GuardrailKeyAssignmentsResponse, OpenRouterError>
List key assignments for a guardrail.
Sourcepub async fn create_guardrail_key_assignments(
&self,
id: &str,
request: &BulkKeyAssignmentRequest,
) -> Result<AssignedCountResponse, OpenRouterError>
pub async fn create_guardrail_key_assignments( &self, id: &str, request: &BulkKeyAssignmentRequest, ) -> Result<AssignedCountResponse, OpenRouterError>
Create key assignments for a guardrail.
Sourcepub async fn delete_guardrail_key_assignments(
&self,
id: &str,
request: &BulkKeyAssignmentRequest,
) -> Result<UnassignedCountResponse, OpenRouterError>
pub async fn delete_guardrail_key_assignments( &self, id: &str, request: &BulkKeyAssignmentRequest, ) -> Result<UnassignedCountResponse, OpenRouterError>
Delete key assignments from a guardrail.
Sourcepub async fn list_guardrail_member_assignments(
&self,
id: &str,
pagination: Option<PaginationOptions>,
) -> Result<GuardrailMemberAssignmentsResponse, OpenRouterError>
pub async fn list_guardrail_member_assignments( &self, id: &str, pagination: Option<PaginationOptions>, ) -> Result<GuardrailMemberAssignmentsResponse, OpenRouterError>
List member assignments for a guardrail.
Sourcepub async fn create_guardrail_member_assignments(
&self,
id: &str,
request: &BulkMemberAssignmentRequest,
) -> Result<AssignedCountResponse, OpenRouterError>
pub async fn create_guardrail_member_assignments( &self, id: &str, request: &BulkMemberAssignmentRequest, ) -> Result<AssignedCountResponse, OpenRouterError>
Create member assignments for a guardrail.
Sourcepub async fn delete_guardrail_member_assignments(
&self,
id: &str,
request: &BulkMemberAssignmentRequest,
) -> Result<UnassignedCountResponse, OpenRouterError>
pub async fn delete_guardrail_member_assignments( &self, id: &str, request: &BulkMemberAssignmentRequest, ) -> Result<UnassignedCountResponse, OpenRouterError>
Delete member assignments from a guardrail.
Sourcepub async fn list_key_assignments(
&self,
pagination: Option<PaginationOptions>,
) -> Result<GuardrailKeyAssignmentsResponse, OpenRouterError>
pub async fn list_key_assignments( &self, pagination: Option<PaginationOptions>, ) -> Result<GuardrailKeyAssignmentsResponse, OpenRouterError>
List global key assignments.
Sourcepub async fn list_member_assignments(
&self,
pagination: Option<PaginationOptions>,
) -> Result<GuardrailMemberAssignmentsResponse, OpenRouterError>
pub async fn list_member_assignments( &self, pagination: Option<PaginationOptions>, ) -> Result<GuardrailMemberAssignmentsResponse, OpenRouterError>
List global member assignments.
Sourcepub async fn list_organization_members(
&self,
pagination: Option<PaginationOptions>,
) -> Result<OrganizationMembersResponse, OpenRouterError>
pub async fn list_organization_members( &self, pagination: Option<PaginationOptions>, ) -> Result<OrganizationMembersResponse, OpenRouterError>
List organization members (GET /organization/members).
Sourcepub async fn list_workspaces(
&self,
pagination: Option<PaginationOptions>,
) -> Result<WorkspaceListResponse, OpenRouterError>
pub async fn list_workspaces( &self, pagination: Option<PaginationOptions>, ) -> Result<WorkspaceListResponse, OpenRouterError>
List workspaces (GET /workspaces).
Sourcepub async fn create_workspace(
&self,
request: &CreateWorkspaceRequest,
) -> Result<Workspace, OpenRouterError>
pub async fn create_workspace( &self, request: &CreateWorkspaceRequest, ) -> Result<Workspace, OpenRouterError>
Create a workspace (POST /workspaces).
Sourcepub async fn get_workspace(
&self,
id: &str,
) -> Result<Workspace, OpenRouterError>
pub async fn get_workspace( &self, id: &str, ) -> Result<Workspace, OpenRouterError>
Get a workspace (GET /workspaces/{id}).
Sourcepub async fn update_workspace(
&self,
id: &str,
request: &UpdateWorkspaceRequest,
) -> Result<Workspace, OpenRouterError>
pub async fn update_workspace( &self, id: &str, request: &UpdateWorkspaceRequest, ) -> Result<Workspace, OpenRouterError>
Update a workspace (PATCH /workspaces/{id}).
Sourcepub async fn update_workspace_with_cleared_io_logging_api_key_ids(
&self,
id: &str,
request: &UpdateWorkspaceRequest,
) -> Result<Workspace, OpenRouterError>
pub async fn update_workspace_with_cleared_io_logging_api_key_ids( &self, id: &str, request: &UpdateWorkspaceRequest, ) -> Result<Workspace, OpenRouterError>
Update a workspace and clear I/O logging API key filters (PATCH /workspaces/{id}).
Sourcepub async fn delete_workspace(&self, id: &str) -> Result<bool, OpenRouterError>
pub async fn delete_workspace(&self, id: &str) -> Result<bool, OpenRouterError>
Delete a workspace (DELETE /workspaces/{id}).
Sourcepub async fn list_workspace_budgets(
&self,
id: &str,
) -> Result<ListWorkspaceBudgetsResponse, OpenRouterError>
pub async fn list_workspace_budgets( &self, id: &str, ) -> Result<ListWorkspaceBudgetsResponse, OpenRouterError>
List budgets for a workspace (GET /workspaces/{id}/budgets).
Sourcepub async fn upsert_workspace_budget(
&self,
id: &str,
interval: &str,
request: &UpsertWorkspaceBudgetRequest,
) -> Result<WorkspaceBudget, OpenRouterError>
pub async fn upsert_workspace_budget( &self, id: &str, interval: &str, request: &UpsertWorkspaceBudgetRequest, ) -> Result<WorkspaceBudget, OpenRouterError>
Create or update a workspace budget (PUT /workspaces/{id}/budgets/{interval}).
Sourcepub async fn delete_workspace_budget(
&self,
id: &str,
interval: &str,
) -> Result<bool, OpenRouterError>
pub async fn delete_workspace_budget( &self, id: &str, interval: &str, ) -> Result<bool, OpenRouterError>
Delete a workspace budget (DELETE /workspaces/{id}/budgets/{interval}).
Sourcepub async fn add_workspace_members(
&self,
id: &str,
request: &WorkspaceMembersRequest,
) -> Result<WorkspaceMembersAddResponse, OpenRouterError>
pub async fn add_workspace_members( &self, id: &str, request: &WorkspaceMembersRequest, ) -> Result<WorkspaceMembersAddResponse, OpenRouterError>
Add workspace members (POST /workspaces/{id}/members/add).
Sourcepub async fn remove_workspace_members(
&self,
id: &str,
request: &WorkspaceMembersRequest,
) -> Result<WorkspaceMembersRemoveResponse, OpenRouterError>
pub async fn remove_workspace_members( &self, id: &str, request: &WorkspaceMembersRequest, ) -> Result<WorkspaceMembersRemoveResponse, OpenRouterError>
Remove workspace members (POST /workspaces/{id}/members/remove).
Trait Implementations§
Source§impl<'a> Clone for ManagementClient<'a>
impl<'a> Clone for ManagementClient<'a>
Source§fn clone(&self) -> ManagementClient<'a>
fn clone(&self) -> ManagementClient<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more