From ea69e37fd56f22dbe6673557bca4c0fed669acbd Mon Sep 17 00:00:00 2001 From: Rohit Agarwal Date: Mon, 22 Dec 2025 14:33:28 +0530 Subject: [PATCH 1/2] fix: Clean up admin-openapi.yaml for Terraform provider Changes: - Remove deprecated Pangea integration (check types and schemas) - Remove prompt completion and render endpoints (not needed for admin API) - Remove completion-related schemas (CreateChatCompletionRequest, etc.) - Simplify GuardrailCheck schema (id as string, parameters as generic object) - Remove 60+ unused component schemas - Fix API key metadata type annotations (additionalProperties: {type: string}) - Add CreateApiKeyResponse schema for proper response typing This reduces complexity and fixes Stainless code generation issues. --- admin-openapi.yaml | 10843 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 10843 insertions(+) create mode 100644 admin-openapi.yaml diff --git a/admin-openapi.yaml b/admin-openapi.yaml new file mode 100644 index 00000000..80323188 --- /dev/null +++ b/admin-openapi.yaml @@ -0,0 +1,10843 @@ +openapi: 3.0.0 +info: + title: Portkey Admin API + description: The Portkey Admin REST API for managing users, workspaces, configs, integrations, providers, prompts, API keys, + guardrails, policies, and audit logs. Please see https://portkey.ai/docs/api-reference for more details. + version: 2.0.0 + termsOfService: https://portkey.ai/terms + contact: + name: Portkey Developer Forum + url: https://portkey.wiki/community + license: + name: MIT + url: https://github.com/Portkey-AI/portkey-openapi/blob/master/LICENSE +servers: +- url: https://api.portkey.ai/v1 + description: Portkey API Public Endpoint +- url: SELF_HOSTED_CONTROL_PLANE_URL + description: Self-Hosted Control Plane URL +tags: +- name: PromptPartials + description: Create, List, Retrieve, Update, and Delete prompt partials. +- name: Prompts + description: Given a prompt template ID and variables, will run the saved prompt template and return a response. +- name: Guardrails + description: Create, List, Retrieve, Update, and Delete prompt Guardrails. +- name: Configs + description: Create, List, Retrieve, and Update your Portkey Configs. +- name: Integrations + description: Create, List, Retrieve, Update, and Delete your Portkey Integrations. +- name: Integrations > Workspaces + description: Manage workspace access for your Portkey Integrations. +- name: Integrations > Models + description: Manage model access for your Portkey Integrations. +- name: Providers + description: Create, List, Retrieve, Update, and Delete your Portkey Providers. +- name: Users + description: Create and manage users. +- name: User-invites + description: Create and manage user invites. +- name: Workspaces + description: Create and manage workspaces. +- name: Workspaces > Members + description: Create and manage workspace members. +- name: Api-Keys + description: Create, List, Retrieve, Update, and Delete your Portkey API keys. +- name: Audit Logs + description: Get audit logs for your Portkey account. +- name: Usage Limits Policies + description: Manage usage limits policies to control total usage over time +- name: Rate Limits Policies + description: Manage rate limits policies to control request or token rates +paths: + /prompts: + servers: &id001 + - url: https://api.portkey.ai/v1 + description: Portkey API Public Endpoint + - url: SELF_HOSTED_CONTROL_PLANE_URL + description: Self-Hosted Control Plane URL + post: + summary: Create a new prompt + operationId: createPrompt + tags: + - Prompts + security: + - Portkey-Key: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - name + - collection_id + - string + - parameters + - virtual_key + properties: + name: + type: string + collection_id: + type: string + description: UUID or slug of the collection + string: + type: string + description: Prompt template in string format + parameters: + type: object + description: Parameters for the prompt + functions: + type: array + description: Functions for the prompt + items: + type: object + tools: + type: array + description: Tools for the prompt + items: + type: object + tool_choice: + type: object + description: Tool Choice for the prompt + model: + type: string + description: The model to use for the prompt + virtual_key: + type: string + description: The virtual key to use for the prompt + version_description: + type: string + description: The description of the prompt version + template_metadata: + type: object + description: Metadata for the prompt + responses: + '200': + description: Prompt created successfully + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + slug: + type: string + version_id: + type: string + format: uuid + object: + type: string + enum: + - prompt + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '500': + description: Server error + get: + summary: List prompts + operationId: listPrompts + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: collection_id + in: query + schema: + type: string + - name: workspace_id + in: query + schema: + type: string + - name: current_page + in: query + schema: + type: integer + - name: page_size + in: query + schema: + type: integer + - name: search + in: query + schema: + type: string + responses: + '200': + description: List of prompts + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/PromptSummary' + total: + type: integer + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '500': + description: Server error + /prompts/{promptId}: + servers: *id001 + get: + summary: Get a prompt by ID or slug + operationId: getPrompt + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: promptId + in: path + required: true + schema: + type: string + responses: + '200': + description: Prompt details + content: + application/json: + schema: + $ref: '#/components/schemas/Prompt' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt not found + '500': + description: Server error + put: + summary: Update a prompt + operationId: updatePrompt + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: promptId + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + collection_id: + type: string + string: + type: string + parameters: + type: object + model: + type: string + virtual_key: + type: string + version_description: + type: string + functions: + type: array + items: + type: object + tools: + type: array + items: + type: object + tool_choice: + type: object + is_raw_template: + type: integer + enum: + - 0 + - 1 + prompt_metadata: + type: object + responses: + '200': + description: Prompt updated successfully + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + slug: + type: string + prompt_version_id: + type: string + format: uuid + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt not found + '500': + description: Server error + delete: + summary: Delete a prompt + operationId: deletePrompt + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: promptId + in: path + required: true + schema: + type: string + responses: + '200': + description: Prompt deleted successfully + content: + application/json: + schema: + type: object + properties: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt not found + '500': + description: Server error + /prompts/{promptId}/versions: + servers: *id001 + get: + summary: Get all versions of a prompt + operationId: getPromptVersions + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: promptId + in: path + required: true + schema: + type: string + responses: + '200': + description: List of prompt versions + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PromptVersionSummary' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt not found + '500': + description: Server error + /prompts/{promptId}/versions/{versionId}: + servers: *id001 + get: + summary: Get a specific version of a prompt + operationId: getPromptByVersion + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: promptId + in: path + required: true + schema: + type: string + - name: versionId + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Prompt version details + content: + application/json: + schema: + $ref: '#/components/schemas/Prompt' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt version not found + '500': + description: Server error + put: + summary: Update a specific version of a prompt + operationId: updatePromptVersion + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: promptId + in: path + required: true + schema: + type: string + - name: versionId + in: path + required: true + schema: + type: string + format: uuid + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + label_id: + type: string + format: uuid + responses: + '200': + description: Prompt version updated successfully + content: + application/json: + schema: + type: object + properties: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt version not found + '500': + description: Server error + /prompts/{promptId}/makeDefault: + servers: *id001 + put: + summary: Set a version as the default for a prompt + operationId: updatePromptDefault + tags: + - Prompts + security: + - Portkey-Key: [] + parameters: + - name: promptId + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - version + properties: + version: + type: number + description: Version Number to set as default + responses: + '200': + description: Default version set successfully + content: + application/json: + schema: + type: object + properties: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt or version not found + '500': + description: Server error + /prompts/partials: + servers: *id001 + post: + summary: Create a new prompt partial + operationId: createPromptPartial + tags: + - PromptPartials + security: + - Portkey-Key: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - name + - string + properties: + workspace_id: + type: string + description: Required for Admin keys + name: + type: string + string: + type: string + description: Prompt partial template in string format + version_description: + type: string + responses: + '200': + description: Prompt partial created successfully + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + slug: + type: string + version_id: + type: string + format: uuid + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '500': + description: Server error + get: + summary: List prompt partials + operationId: listPromptPartials + tags: + - PromptPartials + security: + - Portkey-Key: [] + parameters: + - name: collection_id + in: query + schema: + type: string + responses: + '200': + description: List of prompt partials + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PromptPartialSummary' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not found + '500': + description: Server error + /prompts/partials/{promptPartialId}: + servers: *id001 + get: + summary: Get a prompt partial by ID or slug + operationId: getPromptPartial + tags: + - PromptPartials + security: + - Portkey-Key: [] + parameters: + - name: promptPartialId + in: path + required: true + schema: + type: string + responses: + '200': + description: Prompt partial details + content: + application/json: + schema: + $ref: '#/components/schemas/PromptPartial' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt partial not found + '500': + description: Server error + put: + summary: Update a prompt partial + operationId: updatePromptPartial + tags: + - PromptPartials + security: + - Portkey-Key: [] + parameters: + - name: promptPartialId + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + string: + type: string + description: + type: string + status: + type: string + responses: + '200': + description: Prompt partial updated successfully + content: + application/json: + schema: + type: object + properties: + prompt_partial_version_id: + type: string + format: uuid + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt partial not found + '500': + description: Server error + delete: + summary: Delete a prompt partial + operationId: deletePromptPartial + tags: + - PromptPartials + security: + - Portkey-Key: [] + parameters: + - name: promptPartialId + in: path + required: true + schema: + type: string + responses: + '200': + description: Prompt partial deleted successfully + content: + application/json: + schema: + type: object + properties: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt partial not found + '500': + description: Server error + /prompts/partials/{promptPartialId}/versions: + servers: *id001 + get: + summary: Get all versions of a prompt partial + operationId: getPromptPartialVersions + tags: + - PromptPartials + security: + - Portkey-Key: [] + parameters: + - name: promptPartialId + in: path + required: true + schema: + type: string + responses: + '200': + description: List of prompt partial versions + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PromptPartialVersion' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt partial not found + '500': + description: Server error + /prompts/partials/{promptPartialId}/makeDefault: + servers: *id001 + put: + summary: Set a version as the default for a prompt partial + operationId: updatePromptPartialDefault + tags: + - PromptPartials + security: + - Portkey-Key: [] + parameters: + - name: promptPartialId + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - version + properties: + version: + type: number + description: Version Number to set as default + responses: + '200': + description: Default version set successfully + content: + application/json: + schema: + type: object + properties: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Prompt partial or version not found + '500': + description: Server error + /guardrails: + post: + summary: Create a new guardrail + description: Creates a new guardrail with specified checks and actions + operationId: createGuardrail + tags: + - Guardrails + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGuardrailRequest' + examples: + jwt_authentication: + summary: '[BASIC] JWT Token Validation' + value: + name: JWT Authentication Guard + organisation_id: 550e8400-e29b-41d4-a716-446655440001 + checks: + - id: default.jwt + parameters: + jwksUri: https://example.com/.well-known/jwks.json + headerKey: Authorization + algorithms: + - RS256 + cacheMaxAge: 86400 + clockTolerance: 5 + maxTokenAge: 1d + actions: + onFail: block + message: Invalid JWT token + model_whitelist: + summary: '[BASIC] Model Whitelist Control' + value: + name: Allowed Models Only + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.modelWhitelist + parameters: + models: + - gpt-4 + - gpt-3.5-turbo + - claude-3-sonnet + - claude-3-haiku + actions: + onFail: block + message: Model not in approved whitelist + case_validation: + summary: '[BASIC] Case Validation Checks' + value: + name: Text Case Validation + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.isAllLowerCase + - id: default.alluppercase + parameters: + not: true + actions: + onFail: log + message: Text case validation failed + content_regex: + summary: '[BASIC] Regex Pattern Matching' + value: + name: Content Pattern Validation + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.regexMatch + parameters: + rule: \b(inappropriate|banned|harmful|offensive)\b + not: false + - id: default.endsWith + parameters: + suffix: . + not: false + actions: + onFail: block + message: Content violates pattern rules + length_controls: + summary: '[BASIC] Content Length Controls' + value: + name: Content Length Validation + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.wordCount + parameters: + minWords: 5 + maxWords: 500 + not: false + - id: default.sentenceCount + parameters: + minSentences: 1 + maxSentences: 20 + not: false + - id: default.characterCount + parameters: + minCharacters: 10 + maxCharacters: 4000 + not: false + actions: + onFail: block + message: Content length out of bounds + json_validation: + summary: '[BASIC] JSON Structure Validation' + value: + name: JSON Response Validation + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.jsonSchema + parameters: + schema: + type: object + properties: + result: + type: string + confidence: + type: number + minimum: 0 + maximum: 1 + metadata: + type: object + required: + - result + not: false + - id: default.jsonKeys + parameters: + keys: + - result + - timestamp + - id + operator: all + actions: + onFail: block + message: Response does not match expected format + content_analysis: + summary: '[BASIC] Content Analysis Checks' + value: + name: Content Quality Checks + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.contains + parameters: + words: + - please + - thank you + - help + operator: any + - id: default.validUrls + parameters: + onlyDNS: true + not: false + - id: default.containsCode + parameters: + format: SQL + not: true + actions: + onFail: warn + message: Content quality check failed + webhook_integration: + summary: '[BASIC] Custom Webhook Validation' + value: + name: External Validation Service + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.webhook + parameters: + webhookURL: https://api.example.com/validate-content + headers: + Authorization: Bearer token123 + Content-Type: application/json + X-API-Version: v1 + timeout: 5000 + failOnError: true + actions: + onFail: block + message: External validation failed + metadata_validation: + summary: '[BASIC] Required Metadata Keys' + value: + name: Metadata Requirement Check + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: default.requiredMetadataKeys + parameters: + metadataKeys: + - user_id + - session_id + - request_type + operator: all + actions: + onFail: block + message: Required metadata missing + portkey_moderation: + summary: '[PRO] OpenAI Content Moderation' + value: + name: Advanced Content Moderation + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: portkey.moderateContent + parameters: + categories: + - hate/threatening + - harassment/threatening + - self-harm/intent + - sexual/minors + - violence/graphic + timeout: 5000 + actions: + onFail: block + message: Content flagged by moderation system + portkey_language: + summary: '[PRO] Language Detection & Validation' + value: + name: Multi-Language Support + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: portkey.language + parameters: + language: eng_Latn + not: false + timeout: 5000 + actions: + onFail: block + message: Content not in expected language + portkey_pii: + summary: '[PRO] Advanced PII Detection' + value: + name: PII Protection System + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: portkey.pii + parameters: + redact: true + categories: + - EMAIL_ADDRESS + - PHONE_NUMBER + - SSN + - CREDIT_CARD + - NAME + timeout: 5000 + actions: + onFail: block + message: PII detected and redacted + portkey_gibberish: + summary: '[PRO] Gibberish Detection' + value: + name: Content Quality Filter + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: portkey.gibberish + parameters: + timeout: 5000 + actions: + onFail: block + message: Content appears to be gibberish + sydelabs_security: + summary: '[PARTNER] SydeLabs AI Security' + value: + name: AI Security Suite + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: sydelabs.sydeguard + parameters: + prompt_injection_threshold: 0.5 + toxicity_threshold: 0.3 + evasion_threshold: 0.6 + timeout: 5000 + actions: + onFail: block + message: AI security check failed + aporia_validation: + summary: '[PARTNER] Aporia Project Validation' + value: + name: Aporia Policy Enforcement + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: aporia.validateProject + parameters: + projectID: proj_abc123 + timeout: 5000 + actions: + onFail: block + message: Aporia validation failed + pillar_scanning: + summary: '[PARTNER] Pillar Security Scanning' + value: + name: Comprehensive Security Scan + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: pillar.scanPrompt + parameters: + scanners: + - prompt_injection + - pii + - secrets + - toxic_language + - invisible_characters + timeout: 5000 + - id: pillar.scanResponse + parameters: + scanners: + - pii + - secrets + - toxic_language + timeout: 5000 + actions: + onFail: block + message: Security scan detected issues + patronus_comprehensive: + summary: '[PARTNER] Patronus AI Complete Suite' + value: + name: Patronus Content Analysis + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: patronus.pii + parameters: + redact: true + timeout: 5000 + - id: patronus.toxicity + parameters: + timeout: 5000 + - id: patronus.noGenderBias + parameters: + timeout: 15000 + - id: patronus.isHelpful + parameters: + timeout: 15000 + - id: patronus.custom + parameters: + profile: system:is-concise + timeout: 15000 + actions: + onFail: block + message: Content failed Patronus analysis + azure_content_safety: + summary: '[PARTNER] Azure Content Safety Suite' + value: + name: Microsoft Azure Safety + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: azure.contentSafety + parameters: + blocklistNames: + - company_blocklist + apiVersion: '2024-09-01' + severity: 2 + categories: + - Hate + - SelfHarm + - Sexual + - Violence + timeout: 5000 + - id: azure.pii + parameters: + domain: phi + apiVersion: '2024-11-01' + modelVersion: latest + redact: true + timeout: 5000 + actions: + onFail: block + message: Azure safety checks failed + mistral_moderation: + summary: '[PARTNER] Mistral Content Moderation' + value: + name: Mistral AI Moderation + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: mistral.moderateContent + parameters: + categories: + - sexual + - hate_and_discrimination + - violence_and_threats + - selfharm + - pii + timeout: 5000 + actions: + onFail: block + message: Mistral moderation flagged content + bedrock_enterprise: + summary: '[PARTNER] AWS Bedrock Guardrails' + value: + name: Enterprise AWS Security + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: bedrock.guard + parameters: + guardrailVersion: DRAFT + guardrailId: gdrail123abc + redact: true + timeout: 5000 + actions: + onFail: block + message: AWS Bedrock guardrail violation + promptfoo_testing: + summary: '[PARTNER] Promptfoo Security Testing' + value: + name: Security Testing Suite + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: promptfoo.guard + parameters: + timeout: 5000 + - id: promptfoo.pii + parameters: + redact: true + timeout: 5000 + - id: promptfoo.harm + parameters: + timeout: 5000 + actions: + onFail: block + message: Promptfoo security tests failed + acuvity_comprehensive: + summary: '[PARTNER] Acuvity Multi-Vector Security' + value: + name: Complete Security Analysis + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: acuvity.scan + parameters: + prompt_injection: true + prompt_injection_threshold: 0.5 + toxic: true + toxic_threshold: 0.3 + jail_break: true + jail_break_threshold: 0.6 + malicious_url: true + biased: true + harmful: true + language: true + language_values: english + pii: true + pii_redact: true + pii_categories: + - email_address + - ssn + - credit_card + secrets: true + secrets_redact: true + secrets_categories: + - aws_secret_key + - openai + - github + timeout: 5000 + actions: + onFail: block + message: Comprehensive security scan failed + lasso_classification: + summary: '[PARTNER] Lasso Security Classification' + value: + name: Content Classification + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: lasso.classify + parameters: + timeout: 5000 + actions: + onFail: block + message: Lasso classification failed + panw_prisma: + summary: '[PARTNER] PANW Prisma AIRS Enterprise' + value: + name: Enterprise Security Runtime + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + checks: + - id: panw-prisma-airs.intercept + parameters: + profile_name: enterprise_profile + ai_model: gpt-4 + app_user: api_user_123 + actions: + onFail: block + message: Prisma AIRS blocked request + responses: + '200': + description: Guardrail created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGuardrailResponse' + '400': + description: Bad request - validation failed + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '403': + description: Forbidden - insufficient permissions or guardrail not allowed + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + get: + summary: List guardrails + description: Retrieves a paginated list of guardrails for the specified workspace or organisation + operationId: listGuardrails + tags: + - Guardrails + parameters: + - name: workspace_id + in: query + description: Workspace UUID to filter guardrails + schema: + type: string + format: uuid + - name: organisation_id + in: query + description: Organisation UUID to filter guardrails + schema: + type: string + format: uuid + - name: page_size + in: query + description: Number of items per page + schema: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + - name: current_page + in: query + description: Current page number (0-indexed) + schema: + type: integer + minimum: 0 + default: 0 + responses: + '200': + description: List of guardrails retrieved successfully + content: + application/json: + schema: + $ref: '#/components/schemas/ListGuardrailsResponse' + '400': + description: Bad request - invalid parameters + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '403': + description: Forbidden - insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /guardrails/{guardrailId}: + get: + summary: Get a specific guardrail + description: Retrieves details of a specific guardrail by ID or slug + operationId: getGuardrail + tags: + - Guardrails + parameters: + - name: guardrailId + in: path + required: true + description: Guardrail UUID or slug (with guard_ prefix) + schema: + type: string + examples: + uuid: + summary: Using UUID + value: 550e8400-e29b-41d4-a716-446655440000 + slug: + summary: Using slug + value: guard_abc123 + responses: + '200': + description: Guardrail details retrieved successfully + content: + application/json: + schema: + $ref: '#/components/schemas/GuardrailDetails' + '403': + description: Forbidden - guardrail not found or insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + put: + summary: Update a guardrail + description: Updates an existing guardrail's name, checks, or actions + operationId: updateGuardrail + tags: + - Guardrails + parameters: + - name: guardrailId + in: path + required: true + description: Guardrail UUID or slug to update + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateGuardrailRequest' + responses: + '200': + description: Guardrail updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateGuardrailResponse' + '400': + description: Bad request - validation failed + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '403': + description: Forbidden - guardrail not found or insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + delete: + summary: Delete a guardrail + description: Deletes an existing guardrail + operationId: deleteGuardrail + tags: + - Guardrails + parameters: + - name: guardrailId + in: path + required: true + description: Guardrail UUID or slug to delete + schema: + type: string + responses: + '200': + description: Guardrail deleted successfully + '403': + description: Forbidden - guardrail not found or insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /configs: + servers: *id001 + get: + summary: List all configs + tags: + - Configs + operationId: listConfigs + responses: + '200': + description: A list of configs + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + data: + type: array + items: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + slug: + type: string + organisation_id: + type: string + format: uuid + workspace_id: + type: string + format: uuid + is_default: + type: integer + status: + type: string + owner_id: + type: string + format: uuid + updated_by: + type: string + format: uuid + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + examples: + example-1: + value: + success: true + data: + - id: 4e54a1a4-109c-43ee-b0f7-11e7d60b0066 + name: Pplx Cache Test + slug: pc-pplx-c-ca7a87 + organisation_id: 472d2804-d054-4226-b4ae-9d4e2e61e69e + workspace_id: 472d2804-d054-4226-b4ae-9d4e2e61e69e + is_default: 0 + status: active + owner_id: c4c7996d-be62-429d-b787-5d48fe94da86 + updated_by: 439268ba-94a2-4031-9ca7-ca88ddda5096 + created_at: '2024-05-12T21:37:06.000Z' + last_updated_at: '2024-05-23T23:36:06.000Z' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Retrieve the configuration + config = portkey.configs.list( + workspace_id="WORKSPACE_ID" + ) + + print(config) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + }) + + const config=await portkey.configs.list({ + workspace_id:"WORKSPACE_ID" + }) + console.log(config); + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Retrieve the configuration + config = portkey.configs.list( + workspace_id="WORKSPACE_ID" + ) + + print(config) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const config=await portkey.configs.list({ + workspace_id:"WORKSPACE_ID" + }) + console.log(config); + post: + summary: Create a config + tags: + - Configs + operationId: createConfig + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + config: + type: object + isDefault: + type: integer + workspace_id: + type: string + format: uuid + description: optional, when using organisation admin API keys + examples: + example-1: + value: + name: New config + config: + retry: + attempts: 3 + workspace_id: '' + isDefault: 1 + responses: + '200': + description: Config created successfully + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + data: + type: object + properties: + id: + type: string + format: uuid + version_id: + type: string + format: uuid + examples: + example-1: + value: + success: true + data: + id: f3d8d070-f29d-43a3-bf97-3159c60f4ce0 + version_id: 0db4065b-ead2-4daa-bf5e-7e9106585133 + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Create a new configuration + config = portkey.configs.create( + name="ConfigName_0909", + config={ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "simple" + } + }, + workspace_id="WORKSPACE_ID", + ) + + print(config) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + }) + + const config=await portkey.configs.create({ + name:"ConfigName_0909", + config:{ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "simple" + } + }, + workspace_id:"WORKSPACE_ID" + }) + + console.log(config); + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Create a new configuration + config = portkey.configs.create( + name="ConfigName_0909", + config={ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "simple" + } + }, + workspace_id="WORKSPACE_ID", + ) + + print(config) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const config=await portkey.configs.create({ + name:"ConfigName_0909", + config:{ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "simple" + } + }, + workspace_id:"WORKSPACE_ID" + }) + + console.log(config); + /configs/{slug}: + servers: *id001 + delete: + summary: Delete a config + tags: + - Configs + operationId: deleteConfig + parameters: + - name: slug + in: path + required: true + schema: + type: string + responses: + '200': + description: Config deleted successfully + content: + application/json: + schema: + type: object + examples: + example-1: + value: {} + x-code-samples: + - lang: python + label: Default + source: | + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + portkey.configs.delete( + id="CONFIG_SLUG" + ) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + }) + + await portkey.configs.delete({ + id:"CONFIG_SLUG" + }) + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + portkey.configs.delete( + id="CONFIG_SLUG" + ) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + await portkey.configs.delete({ + id:"CONFIG_SLUG" + }) + get: + servers: *id001 + summary: Get a config + tags: + - Configs + operationId: getConfig + parameters: + - name: slug + in: path + required: true + schema: + type: string + responses: + '200': + description: Config details + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + data: + type: object + properties: + config: + type: object + properties: + retry: + type: object + properties: + attempts: + type: integer + on_status_codes: + type: array + items: + type: integer + cache: + type: object + properties: + mode: + type: string + max_age: + type: integer + strategy: + type: object + properties: + mode: + type: string + targets: + type: array + items: + type: object + properties: + provider: + type: string + virtual_key: + type: string + examples: + example-1: + value: + success: true + data: + config: + retry: + attempts: 5 + on_status_codes: + - 429 + - 529 + cache: + mode: simple + max_age: 3600 + strategy: + mode: fallback + targets: + - provider: openai + virtual_key: main-258f4d + - provider: azure-openai + virtual_key: azure-test-4110dd + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Retrieve the configuration + config = portkey.configs.retrieve( + slug='CONFIG_SLUG' + ) + + print(config) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + }) + + const config=await portkey.configs.retrieve({ + slug:'CONFIG_SLUG' + }) + + console.log(config); + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Retrieve the configuration + config = portkey.configs.retrieve( + slug='CONFIG_SLUG' + ) + + print(config) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const config=await portkey.configs.retrieve({ + slug:'CONFIG_SLUG' + }) + + console.log(config); + put: + servers: *id001 + summary: Update a config + tags: + - Configs + operationId: updateConfig + parameters: + - name: slug + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + config: + type: object + properties: + virtual_key: + type: string + status: + type: string + examples: + example-1: + value: + name: testConf + config: + virtual_key: copy-of-anthrop-b20259 + status: active + responses: + '200': + description: Config updated successfully + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + data: + type: object + properties: + version_id: + type: string + format: uuid + examples: + example-1: + value: + success: true + data: + version_id: abe447e2-f6aa-4229-93b7-8ee3183b6667 + x-code-samples: + - lang: python + label: Default + source: | + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Update the configuration + updated_config = portkey.configs.update( + slug="CONFIG_SLUG", + name="Updated Config", + config={ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "semantic" + } + } + ) + print(updated_config) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + }) + + const config=await portkey.configs.update({ + slug:"CONFIG_SLUG", + name:"Updated Config", + config:{ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "semantic" + } + }, + + }) + + console.log(config); + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Update the configuration + updated_config = portkey.configs.update( + slug="CONFIG_SLUG", + name="Updated Config", + config={ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "semantic" + } + } + ) + print(updated_config) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const config=await portkey.configs.update({ + slug:"CONFIG_SLUG", + name:"Updated Config", + config:{ + "retry": { + "attempts": 3 + }, + "cache": { + "mode": "semantic" + } + }, + + }) + + console.log(config); + /configs/{slug}/versions: + servers: *id001 + get: + summary: List versions for a config + tags: + - Configs + operationId: listConfigVersions + parameters: + - name: slug + in: path + required: true + schema: + type: string + responses: + '200': + description: A list of config versions + content: + application/json: + schema: + type: object + properties: + object: + type: string + total: + type: integer + data: + type: array + items: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + workspace_id: + type: string + format: uuid + slug: + type: string + organisation_id: + type: string + format: uuid + is_default: + type: integer + status: + type: string + owner_id: + type: string + format: uuid + updated_by: + type: string + format: uuid + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + config: + type: string + description: Serialized configuration for this version + format: + type: string + type: + type: string + version_id: + type: string + format: uuid + object: + type: string + examples: + example-1: + value: + object: list + total: 1 + data: + - id: daab995b-8d3b-42c5-a490-47217fbf4e0e + name: PII Redaction Guardrail + workspace_id: 8610029e-692a-4df6-9052-3fa3eff69911 + slug: pc-pii-re-7f1051 + organisation_id: 472d2804-d054-4226-b4ae-9d4e2e61e69e + is_default: 0 + status: active + owner_id: c4c7996d-be62-429d-b787-5d48fe94da86 + updated_by: c4c7996d-be62-429d-b787-5d48fe94da86 + created_at: '2025-10-17T19:11:47.000Z' + last_updated_at: '2025-10-17T19:11:47.000Z' + config: '{"input_guardrails":["pg-patron-1d0224"]}' + format: json + type: ORG_CONFIG + version_id: 8c1a4fbf-26d9-49df-82ca-ab772ba397d2 + object: config + x-code-samples: + - lang: curl + label: Default + source: | + curl --location 'https://api.portkey.ai/v1/configs/pc-pii-re-7f1051/versions' \ + --header 'x-portkey-api-key: PORTKEY_API_KEY' + /integrations: + servers: *id001 + get: + summary: List All Integrations + tags: + - Integrations + parameters: + - in: query + name: current_page + schema: + type: integer + description: Current page, defaults to 0 + - in: query + name: page_size + schema: + type: integer + description: Page size, default to 100 + - in: query + name: workspace_id + schema: + type: string + description: Filter integrations accessible by a specific workspace. When using workspace API keys, this value will + be enforced based on the API key details + - in: query + name: type + schema: + type: string + enum: + - workspace + - organisation + - all + default: all + description: For type=workspace, the API will only return Workpace-Scoped integrations. For type=organisation, the + API will only return Global (organisation level) integrations. For type=all, both types of integrations will be + returned. + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + object: + type: string + enum: + - list + total: + type: integer + description: Total number of integrations + data: + type: array + items: + $ref: '#/components/schemas/IntegrationList' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # List integrations + integrations = portkey.integrations.list() + + print(integrations) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const integrations = await portkey.integrations.list({}) + console.log(integrations); + - lang: curl + label: Default + source: | + curl -X GET https://api.portkey.ai/v1/integrations \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # List integrations + integrations = portkey.integrations.list() + + print(integrations) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const integrations = await portkey.integrations.list({}) + console.log(integrations); + - lang: curl + label: Self-Hosted + source: | + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/integrations \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + post: + summary: Create a Integration + tags: + - Integrations + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateIntegrationRequest' + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: UUID + slug: + type: string + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Add a new integration + integration = portkey.integrations.create( + name="openai-production", + ai_provider_id="openai", + key="sk-..." + ) + + print(integration) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const integration = await portkey.integrations.create({ + name:"openai-production", + ai_provider_id:"openai", + key:"sk-...", + }) + console.log(integration); + - lang: curl + label: Default + source: | + curl -X POST https://api.portkey.ai/v1/integrations \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openai-production", + "ai_provider_id": "openai", + "key": "sk-..." + }' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Add a new integration + integration = portkey.integrations.create( + name="openai-production", + ai_provider_id="openai", + key="sk-..." + ) + + print(integration) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const integration = await portkey.integrations.create({ + name: "openai-production", + ai_provider_id: "openai", + key: "sk-...", + }) + console.log(integration); + - lang: curl + label: Self-Hosted + source: | + curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/integrations \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openai-production", + "ai_provider_id": "openai", + "key": "sk-..." + }' + /integrations/{slug}: + servers: *id001 + get: + summary: Get a Integration + tags: + - Integrations + parameters: + - in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/IntegrationDetailResponse' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get a specific virtual key + virtual_key = portkey.virtual_keys.retrieve( + slug='VIRTUAL_KEY_SLUG' + ) + + print(virtual_key) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const vKey=await portkey.virtualKeys.retrieve({ + slug:'VIRTUAL_KEY_SLUG' + }) + console.log(vKey); + - lang: curl + label: Default + source: | + curl -X GET https://api.portkey.ai/v1/virtual-keys/VIRTUAL_KEY_SLUG \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys/VIRTUAL_KEY_SLUG \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get a specific virtual key + virtual_key = portkey.virtual_keys.retrieve( + slug='VIRTUAL_KEY_SLUG' + ) + + print(virtual_key) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const vKey=await portkey.virtualKeys.retrieve({ + slug:'VIRTUAL_KEY_SLUG' + }) + console.log(vKey); + put: + summary: Update a Integration + tags: + - Integrations + parameters: + - in: path + name: slug + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateIntegrationRequest' + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Update a specific integration + integration = portkey.integrations.update( + slug="INTEGRATION_SLUG', + name="updated-name", + note="hello" + ) + + print(integration) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const integration = await portkey.integrations.update({ + slug:"INTEGRATION_SLUG", + name:"updated-name", + note:"hello" + }) + console.log(integration); + - lang: curl + label: Default + source: | + curl -X PUT "https://api.portkey.ai/v1/integrations/INTEGRATION_SLUG" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "updated-name", + "note": "hello" + }' + - lang: curl + label: Self-Hosted + source: | + curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/integrations/INTEGRATION_SLUG" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "updated-name", + "note": "hello" + }' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Update a specific integration + integration = portkey.integrations.update( + slug="INTEGRATION_SLUG', + name="updated-name", + note="hello" + ) + + print(integration) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const integration = await portkey.integrations.update({ + slug:'INTEGRATION_SLUG', + name:"updated-name", + note:"hello" + }) + console.log(integration); + delete: + summary: Delete a Integration + tags: + - Integrations + parameters: + - in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Delete a specific integration + result = portkey.integrations.delete( + slug="INTEGRATION_SLUG" + ) + + print(result) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const result=await portkey.integrations.delete({ + slug:'INTEGRATION_SLUG', + }) + console.log(result); + - lang: curl + label: Default + source: | + curl -X DELETE https://api.portkey.ai/v1/integrations/INTEGRATION_SLUG + - lang: curl + label: Self-Hosted + source: | + curl -X DELETE https://SELF_HOSTED_CONTROL_PLANE_URL/integrations/INTEGRATION_SLUG + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete a specific integration + result = portkey.integrations.delete( + slug="INTEGRATION_SLUG" + ) + + print(result) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const result=await portkey.integrations.delete({ + slug:"INTEGRATION_SLUG", + }) + console.log(result); + /integrations/{slug}/models: + get: + summary: List integration models + description: Retrieves all model access for a specific integration with their configuration and pricing details. + tags: + - Integrations > Models + parameters: + - in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: List of integration models + content: + application/json: + schema: + $ref: '#/components/schemas/IntegrationModelsResponse' + put: + summary: Bulk update integration models + description: | + Updates model access, pricing configuration, and settings for multiple models in an integration. + Can enable/disable models and configure custom pricing. + tags: + - Integrations > Models + parameters: + - in: path + name: slug + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BulkUpdateModelsRequest' + responses: + '200': + description: Models updated successfully + content: + application/json: + schema: + type: object + delete: + summary: Bulk delete integration custom models + description: Removes multiple custom models from an integration by their slugs. + tags: + - Integrations > Models + parameters: + - in: path + name: slug + required: true + schema: + type: string + - name: slugs + in: query + required: true + description: Comma-separated list of model slugs to delete + schema: + type: string + example: gpt-4,gpt-3.5-turbo + responses: + '200': + description: Models deleted successfully + content: + application/json: + schema: + type: object + /integrations/{slug}/workspaces: + get: + summary: List integration workspace access + description: Retrieves workspace access configuration for an integration, including usage limits and rate limits. + tags: + - Integrations > Workspaces + parameters: + - in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: List of workspace access configurations + content: + application/json: + schema: + $ref: '#/components/schemas/IntegrationWorkspacesResponse' + put: + summary: Bulk update workspace access + description: | + Updates workspace access permissions, usage limits, and rate limits for an integration. + Can configure global workspace access or per-workspace settings. + tags: + - Integrations > Workspaces + parameters: + - in: path + name: slug + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BulkUpdateWorkspacesRequest' + responses: + '200': + description: Workspace access updated successfully + content: + application/json: + schema: + type: object + /providers: + servers: *id001 + get: + summary: List All Providers + tags: + - Providers + parameters: + - in: query + name: current_page + schema: + type: integer + description: Current page, defaults to 0 + - in: query + name: page_size + schema: + type: integer + description: Page size, default to 50 + - in: query + name: workspace_id + schema: + type: string + description: Not required when using workspace API keys. Required when using organisation admin keys + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + object: + type: string + enum: + - list + total: + type: integer + description: Total number of providers + data: + type: array + items: + $ref: '#/components/schemas/Providers' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + # List providers + # Optional workspace_id + providers = portkey.providers.list(workspace_id="") + + print(providers) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const providers = await portkey.providers.list({ + workspaceId: "" // Optional + }) + console.log(providers); + - lang: curl + label: Default + source: | + curl -X GET https://api.portkey.ai/v1/providers?workspace_id= \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # List virtual keys + # Optional workspace_id + providers = portkey.providers.list(workspace_id="") + + print(providers) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const providers = await portkey.providers.list({ + workspace_id: "" // Optional + }) + console.log(providers); + - lang: curl + label: Self-Hosted + source: | + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/providers?workspace_id= \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + post: + summary: Create a Provider + tags: + - Providers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + integration_id: + type: string + description: Integration slug used for the provider creation. + workspace_id: + type: string + format: uuid + description: optional, needed when using organisation admin API keys + slug: + type: string + description: Slug for the provider. If not passed, slug will be created by adding a random suffix to the + name. + note: + type: string + nullable: true + usage_limits: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + $ref: '#/components/schemas/RateLimits' + expires_at: + type: string + format: date-time + required: + - name + - integration_id + examples: + generic: + value: + name: My first provider + note: Provider description + integration_id: my-openai-integration + usage_limits: + credit_limit: 10 + periodic_reset: monthly + alert_threshold: 9 + workspace_id: '' + slug: first-openai-provider + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + id: + type: string + slug: + type: string + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Add a new provider + new_provider = portkey.providers.create( + name="openai provider", + integration_id="", + workspace_id="" + ) + + print(new_provider) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const provider = await portkey.providers.create({ + name: "openai provider", + integration_id: "", + workspace_id: "" + }) + console.log(provider); + - lang: curl + label: Default + source: | + curl -X POST https://api.portkey.ai/v1/providers \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openai provider", + "integration_id": "", + "workspace_id": "" + }' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Add a new provider + new_provider = portkey.providers.create( + name="openai provider", + integration_id="", + workspace_id="" + ) + + print(new_provider) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const newProvider = await portkey.providers.create({ + name: "openai provider", + integration_id: "", + workspace_id: "" + }) + console.log(newProvider); + - lang: curl + label: Self-Hosted + source: | + curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/providers \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openai provider", + "integrationId": "", + "workspaceId": "" + }' + /providers/{slug}: + servers: *id001 + get: + summary: Get a Provider + tags: + - Providers + parameters: + - in: query + name: workspace_id + schema: + type: string + description: optional, needed when using organisation admin keys + - in: path + name: slug + schema: + type: string + required: true + description: Provider slug + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/Providers' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get a specific provider + provider = portkey.providers.retrieve( + slug="PROVIDER_SLUG", + workspace_id="" + ) + + print(provider) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const provider = await portkey.providers.retrieve({ + slug:"PROVIDER_SLUG", + workspace_id: "" + }) + console.log(provider); + - lang: curl + label: Default + source: | + curl -X GET https://api.portkey.ai/v1/providers/PROVIDER_SLUG?workspace_id= \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/providers/PROVIDER_SLUG?workspace_id= \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get a specific provider + provider = portkey.providers.retrieve( + slug="PROVIDER_SLUG", + workspace_id="" + ) + + print(provider) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const provider = await portkey.providers.retrieve({ + slug: "PROVIDER_SLUG", + workspace_id: "" + }) + console.log(provider); + put: + summary: Update a Provider + tags: + - Providers + parameters: + - in: query + name: workspace_id + schema: + type: string + description: optional, needed when using organisation admin keys + - in: path + name: slug + schema: + type: string + required: true + description: Provider slug + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + note: + type: string + usage_limits: + $ref: '#/components/schemas/UsageLimits' + nullable: true + rate_limits: + $ref: '#/components/schemas/RateLimits' + expires_at: + type: string + format: date-time + nullable: true + reset_usage: + type: boolean + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: UUID + slug: + type: string + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Update a specific provider + updated_provider = portkey.providers.update( + slug="PROVIDER_SLUG", + name="updated-name", + note="updated-note", + workspace_id="" + ) + + print(updated_provider) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const updatedProvider = await portkey.providers.update({ + slug: "PROVIDER_SLUG", + name:"updated-name", + note: "updated-note", + workspace_id: "" + }) + console.log(updatedProvider); + - lang: curl + label: Default + source: | + curl -X PUT "https://api.portkey.ai/v1/providers/PROVIDER_SLUG?workspace_id=" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "updated-name", + "note": "updated-note" + }' + - lang: curl + label: Self-Hosted + source: | + curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/providers/PROVIDER_SLUG?workspace_id=" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "updated-name", + "note": "updated-note" + }' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Update a specific provider + updated_provider = portkey.providers.update( + slug="PROVIDER_SLUG", + name="updated-name", + note="updated-note", + workspace_id="" + ) + + print(updated_provider) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const updatedProvider = await portkey.providers.update({ + slug: "PROVIDER_SLUG", + name:"updated-name", + note: "updated-note", + workspace_id: "" + }) + console.log(updatedProvider); + delete: + summary: Delete a Provider + tags: + - Providers + parameters: + - in: query + name: workspace_id + schema: + type: string + description: optional, needed when using organisation admin keys + - in: path + name: slug + schema: + type: string + required: true + description: Provider slug + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Delete a specific virtual key + result = portkey.providers.delete( + slug="PROVIDER_SLUG", + workspace_id="" + ) + + print(result) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const result = await portkey.providers.delete({ + slug: "PROVIDER_SLUG", + workspace_id: "" + }) + console.log(result); + - lang: curl + label: Default + source: | + curl -X DELETE https://api.portkey.ai/v1/providers/PROVIDER_SLUG?workspace_id= + - lang: curl + label: Self-Hosted + source: | + curl -X DELETE https://SELF_HOSTED_CONTROL_PLANE_URL/providers/PROVIDER_SLUG?workspace_id + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete a specific provider + result = portkey.providers.delete( + slug="PROVIDER_SLUG", + workspace_id="" + ) + + print(result) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const result = await portkey.providers.delete({ + slug: "PROVIDER_SLUG", + workspace_id: "" + }) + console.log(result); + /admin/users/invites: + servers: *id001 + post: + operationId: Invites_create + summary: Invite User + description: Send an invite to user for your organization + parameters: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessInvite' + tags: + - User-invites + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateInvite' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Add a user invite + user = portkey.admin.users.invites.create( + email="user@example.com", + role="member", + workspaces=[ + { + "id": "WORKSPACE_SLUG", + "role": "admin" + } + ], + workspace_api_key_details={ + "scopes": [ + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + ] + } + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.users.invites.create({ + email:"user@example.com", + role: "member", + workspaces: [ + { + id:"WORKSPACE_SLUG", + role:"admin" + }], + workspace_api_key_details:{ + scopes: [ + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + ] + } + }) + + console.log(user); + - lang: curl + label: Default + source: | + curl -X POST https://api.portkey.ai/v1/admin/users/invites + -H "x-portkey-api-key: PORTKEY_API_KEY" + -H "Content-Type: application/json" + -d '{ + "email": "user@example.com", + "role": "member", + "workspaces": [ + { + "id": "WORKSPACE_SLUG", + "role": "admin" + } + ], + "workspace_api_key_details": { + "scopes": [ + "workspaces.list", + "logs.export", + "logs.list", + "logs.view" + ] + } + }' + - lang: curl + label: Self-Hosted + source: | + curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/admin/users/invites + -H "x-portkey-api-key: PORTKEY_API_KEY" + -H "Content-Type: application/json" + -d '{ + "email": "user@example.com", + "role": "member", + "workspaces": [ + { + "id": "WORKSPACE_SLUG", + "role": "admin" + } + ], + "workspace_api_key_details": { + "scopes": [ + "workspaces.list", + "logs.export", + "logs.list", + "logs.view" + ] + } + }' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Add a user invite + user = portkey.admin.users.invites.create( + email="user@example.com", + role="member", + workspaces=[ + { + "id": "WORKSPACE_SLUG", + "role": "admin" + } + ], + workspace_api_key_details={ + "scopes": [ + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + ] + } + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user = await portkey.admin.users.invites.create({ + email: "user@example.com", + role: "member", + workspaces: [ + { + id: "WORKSPACE_SLUG", + role: "admin" + } + ], + workspace_api_key_details: { + scopes: [ + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + ] + } + }) + + console.log(user); + get: + tags: + - User-invites + summary: Get All Invites + parameters: + - name: pageSize + in: query + schema: + type: integer + example: '1' + - name: currentPage + in: query + schema: + type: integer + example: '0' + - name: role + in: query + schema: + type: string + enum: + - admin + - member + example: admin + - name: email + in: query + schema: + type: string + format: email + example: foo@bar.com + - name: status + in: query + schema: + type: string + enum: + - pending + - cancelled + - accepted + - expired + example: pending + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/InviteList' + example: + object: list + total: 2 + data: + - object: invite + id: 419641fb-1458-47d6-94d0-e308159b3ec2 + email: horace.slughorn@example.com + role: member + created_at: '2023-12-12 13:56:32' + expires_at: '2023-12-12 13:56:32' + accepted_at: '2023-12-12 13:56:32' + status: pending + invited_by: a90e74fb-269e-457b-8b59-9426cdd8907e + workspaces: + - workspace_id: '' + role: '' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # List user invites + user_invites = portkey.admin.users.invites.list( + email="user@example.com" + ) + + print(user_invites) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.users.invites.list({ + email:"user@example.com" + }); + console.log(user); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/admin/users/invites?email=user@example.com" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/invites?email=user@example.com" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # List user invites + user_invites = portkey.admin.users.invites.list( + email="user@example.com" + ) + + print(user_invites) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.users.invites.list({ + email:"user@example.com" + }); + console.log(user); + /admin/users/invites/{inviteId}: + servers: *id001 + get: + tags: + - User-invites + summary: Get Invite + parameters: + - name: inviteId + in: path + schema: + type: string + required: true + description: string + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/Invite' + example: + object: invite + id: 419641fb-1458-47d6-94d0-e308159b3ec2 + email: horace.slughorn@example.com + role: member + created_at: '2023-12-12 13:56:32' + expires_at: '2023-12-12 13:56:32' + accepted_at: '2023-12-12 13:56:32' + status: pending + invited_by: 8dcfa174-c5ed-42c7-8a63-be755cc6e3123 + workspaces: + - workspace_id: '' + role: '' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get a user invite + user = portkey.admin.users.invites.retrieve( + invite_id='INVITE_ID' + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.users.invites.retrieve({ + inviteId: 'INVITE_ID', + }); + console.log(user); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/admin/users/invites/INVITE_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/invites/INVITE_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get a user invite + user = portkey.admin.users.invites.retrieve( + invite_id='INVITE_ID' + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.users.invites.retrieve({ + inviteId: 'INVITE_ID', + }); + console.log(user); + delete: + tags: + - User-invites + summary: Delete Invite By ID + parameters: + - name: inviteId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + + + # Delete a user invite + user = portkey.admin.users.invites.delete( + invite_id="INVITE_ID" + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.users.invites.delete({ + inviteId:"INVITE_ID" + }) + + console.log(user); + - lang: curl + label: Default + source: | + curl -X DELETE "https://api.portkey.ai/v1/admin/users/invites/INVITE_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/invites/INVITE_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete a user invite + user = portkey.admin.users.invites.delete( + invite_id="INVITE_ID" + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.users.invites.delete({ + inviteId:"INVITE_ID" + }) + + console.log(user); + /admin/users/invites/{inviteId}/resend: + servers: *id001 + post: + tags: + - User-invites + summary: Resend Invite + description: Resend an invite to user for your organization + parameters: + - name: inviteId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + properties: + inviteLink: + type: string + format: uri + example: + inviteLink: https://app.portkey.ai/invite/some-invite-link + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + + + # Delete a user invite + user = portkey.admin.users.invites.resend( + invite_id="INVITE_ID" + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.users.invites.resend({ + inviteId:"INVITE_ID" + }); + + console.log(user); + - lang: curl + label: Default + source: | + curl -X POST "https://api.portkey.ai/v1/admin/users/invites/INVITE_ID/resend" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X POST "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/invites/INVITE_ID/resend" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete a user invite + user = portkey.admin.users.invites.resend( + invite_id="INVITE_ID" + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.users.invites.resend({ + inviteId:"INVITE_ID" + }); + + console.log(user); + /admin/users: + servers: + - url: https://api.portkey.ai/v1 + - url: https://SELF_HOSTED_CONTROL_PLANE_URL + get: + tags: + - Users + summary: Get users + parameters: + - name: x-portkey-api-key + in: header + schema: + type: string + example: '{{PORTKEY_API_KEY}}' + - name: pageSize + in: query + schema: + type: integer + example: '1' + - name: currentPage + in: query + schema: + type: integer + example: '0' + - name: role + in: query + schema: + type: string + enum: + - admin + - member + - owner + example: admin + - name: email + in: query + schema: + type: string + format: email + example: foo@bar.com + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/UserList' + example: + total: 2 + object: list + data: + - object: user + id: 61e08f60-4822-465e-ba23-39f85cd741cb + first_name: horace + last_name: slughorn + role: member + email: horace.slughorn@example.com + created_at: '2024-01-25 11:35:07' + last_updated_at: '2024-01-25 11:35:07' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # List users + users = portkey.admin.users.list() + + print(users) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const users=await portkey.admin.users.list({}) + + console.log(users); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/admin/users" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/users" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # List users + users = portkey.admin.users.list() + + print(users) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const users=await portkey.admin.users.list({}) + + console.log(users); + /admin/users/{userId}: + servers: + - url: https://api.portkey.ai/v1 + - url: https://SELF_HOSTED_CONTROL_PLANE_URL + get: + tags: + - Users + summary: Get user + parameters: + - name: userId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/User' + example: + object: user + id: 61e08f60-4822-465e-ba23-39f85cd741cb + first_name: horace + last_name: slughorn + role: member + email: horace.slughorn@example.com + created_at: '2024-01-25 11:35:07' + last_updated_at: '2024-01-25 11:35:07' + workspace_ids: + - ws-shared-123 + x-code-sample: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get a specific user + user = portkey.admin.users.retrieve( + user_id='USER_ID' + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + const user = await portkey.admin.users.retrieve({ + userId: 'USER_ID', + }); + + console.log(user); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/admin/users/USER_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/USER_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get a specific user + user = portkey.admin.users.retrieve( + user_id='USER_ID' + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + const user = await portkey.admin.users.retrieve({ + userId: 'USER_ID', + }); + + console.log(user); + delete: + tags: + - Users + summary: Remove a user + parameters: + - name: userId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Delete a user + user = portkey.admin.users.delete( + user_id='USER_ID' + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.users.delete({ + userId: 'USER_ID', + }) + + console.log(user); + - lang: curl + label: Default + source: | + curl -X DELETE "https://api.portkey.ai/v1/admin/users/USER_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/USER_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete a user + user = portkey.admin.users.delete( + user_id='USER_ID' + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.users.delete({ + userId: 'USER_ID', + }) + + console.log(user); + put: + tags: + - Users + summary: Update user + requestBody: + content: + application/json: + schema: + type: object + properties: + role: + type: string + enum: + - admin + - member + example: + role: admin + parameters: + - name: userId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Update a user + user = portkey.admin.users.update( + user_id='USER_ID', + role="member" + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user = await portkey.admin.users.update({ + userId: 'USER_ID', + role: "member" + }) + + console.log(user); + - lang: curl + label: Default + source: | + curl -X PUT "https://api.portkey.ai/v1/admin/users/USER_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + -d '{"role":"member"}' + - lang: curl + label: Self-Hosted + source: | + curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/USER_ID" + -H "x-portkey-api-key: PORTKEY_API_KEY" + -d '{"role":"member"}' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Update a user + user = portkey.admin.users.update( + user_id='USER_ID', + role="member" + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user = await portkey.admin.users.update({ + userId: 'USER_ID', + role: "member" + }) + + console.log(user); + /admin/workspaces/{workspaceId}/users: + servers: + - url: https://api.portkey.ai/v1 + - url: https://SELF_HOSTED_CONTROL_PLANE_URL + post: + tags: + - Workspaces > Members + summary: Add workspace member + requestBody: + content: + application/json: + schema: + type: object + properties: + users: + type: array + items: + type: object + properties: + id: + type: string + format: uuid + example: 25afb7bd-f98a-11ee-85fe-0e27d7367987 + role: + type: string + example: member + enum: + - admin + - member + - manager + example: + users: + - id: 419641fb-1458-47d6-94d0-e308159b3ec2 + role: member + - id: 419641fb-1458-47d6-94d0-e308159b3ec3 + role: member + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Add user to workspace + user = portkey.admin.workspaces.users.create( + workspace_id="WORKSPACE_SLUG", + users=[ + { + "id": "USER_ID", + "role": "member" + } + ] + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.workspaces.users.create({ + workspaceId: "WORKSPACE_SLUG", + users:[{ + id:"USER_ID", + role:'member' + }] + }) + console.log(user); + - lang: curl + label: Default + source: | + curl -X POST "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}/users" + -H "x-portkey-api-key: PORTKEY_API_KEY" + -d '{"users":[{"id":"USER_ID","role":"member"}]}' + - lang: curl + label: Self-Hosted + source: | + curl -X POST "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}/users" + -H "x-portkey-api-key: PORTKEY_API_KEY" + -d '{"users":[{"id":"USER_ID","role":"member"}]}' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Add user to workspace + user = portkey.admin.workspaces.users.create( + workspace_id="WORKSPACE_SLUG", + users=[ + { + "id": "USER_ID", + "role": "member" + } + ] + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user = await portkey.admin.workspaces.users.create({ + workspaceId: "WORKSPACE_SLUG", + users: [{ + id: "USER_ID", + role: 'member' + }] + }) + + console.log(user); + get: + tags: + - Workspaces > Members + summary: Get workspace members + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + - name: current_page + in: query + schema: + type: number + default: 50 + required: false + - name: page_size + in: query + schema: + type: number + default: 0 + required: false + - name: role + in: query + schema: + type: string + enum: + - admin + - manager + - member + example: admin + - name: email + in: query + schema: + type: string + example: foo@bar.com + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/WorkspaceMemberList' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get user from workspace + users = portkey.admin.workspaces.users.list( + workspace_id="WORKSPACE_SLUG", + ) + + print(users) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.workspaces.users.list({ + workspaceId: 'WORKSPACE_SLUG', + }) + console.log(user); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}/users" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}/users" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get user from workspace + users = portkey.admin.workspaces.users.list( + workspace_id="WORKSPACE_SLUG", + ) + + print(users) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.workspaces.users.list({ + workspaceId: 'WORKSPACE_SLUG', + }) + console.log(user); + /admin/workspaces/{workspaceId}/users/{userId}: + servers: *id001 + put: + tags: + - Workspaces > Members + summary: Update workspace member + requestBody: + content: + application/json: + schema: + type: object + properties: + role: + type: string + enum: + - admin + - member + - manager + example: + role: member + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + - name: userId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Update user in workspace + updated_user = portkey.admin.workspaces.users.update( + workspace_id='WORKSPACE_SLUG', + user_id="USER_ID", + role='member' + ) + + print(updated_user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.workspaces.users.update({ + workspaceId: 'WORKSPACE_SLUG', + userId:"USER_ID", + role:'member' + }) + console.log(user); + - lang: curl + label: Default + source: | + curl -X PUT "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}/users/{userId}" + -H "x-portkey-api-key: PORTKEY_API_KEY" + -d '{"role":"member"}' + - lang: curl + label: Self-Hosted + source: | + curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}/users/{userId}" + -H "x-portkey-api-key: PORTKEY_API_KEY" + -d '{"role":"member"}' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Update user in workspace + updated_user = portkey.admin.workspaces.users.update( + workspace_id='WORKSPACE_SLUG', + user_id="USER_ID", + role='member' + ) + + print(updated_user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.workspaces.users.update({ + workspaceId: 'WORKSPACE_SLUG', + userId:"USER_ID", + role:'member' + }) + console.log(user); + delete: + tags: + - Workspaces > Members + summary: Remove workspace member + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + - name: userId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Delete user from workspace + result = portkey.admin.workspaces.users.delete( + workspace_id='WORKSPACE_SLUG', + user_id='USER_ID' + ) + + # Print the result (if any) + print(result) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + user = await portkey.admin.workspaces.users.delete({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID' + }) + + console.log(user) + - lang: curl + label: Default + source: | + curl -X DELETE "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}/users/{userId}" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}/users/{userId}" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete user from workspace + result = portkey.admin.workspaces.users.delete( + workspace_id='WORKSPACE_SLUG', + user_id='USER_ID' + ) + + # Print the result (if any) + print(result) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + user = await portkey.admin.workspaces.users.delete({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID' + }) + + console.log(user) + get: + tags: + - Workspaces > Members + summary: Get member + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + - name: userId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/WorkspaceMember' + example: + object: workspace_member + user_id: 61e08f60-4822-465e-ba23-39f85cd741cb + user: + object: user + id: 61e08f60-4822-465e-ba23-39f85cd741cb + first_name: horace + last_name: slughorn + email: horace.slughorn@example.com + role: admin + created_at: '2024-01-25 11:35:07' + last_updated_at: '2024-01-25 11:35:07' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get user from workspace + user = portkey.admin.workspaces.users.retrieve( + workspace_id="WORKSPACE_SLUG", + user_id="USER_ID" + ) + + print(user) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const user=await portkey.admin.workspaces.users.retrieve({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID', + }) + console.log(user); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}/users/{userId}" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}/users/{userId}" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get user from workspace + user = portkey.admin.workspaces.users.retrieve( + workspace_id="WORKSPACE_SLUG", + user_id="USER_ID" + ) + + print(user) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const user=await portkey.admin.workspaces.users.retrieve({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID', + }) + console.log(user); + /admin/workspaces: + servers: *id001 + post: + tags: + - Workspaces + summary: Create Workspace + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: + type: string + defaults: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + users: + type: array + items: + type: string + usage_limits: + type: array + items: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + type: array + items: + $ref: '#/components/schemas/RateLimits' + example: + name: My Workspace + description: My Description + defaults: + metadata: + environment: production + foo: bar + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/Workspace' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Add a workspace + workspace = portkey.admin.workspaces.create( + name='WORKSPACE_NAME_0909', + description="WORKSPACE_DESCRIPTION", + defaults={ + "metadata": { + "environment": "production", + "foo": "bar" + } + } + ) + + print(workspace) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const workspace=await portkey.admin.workspaces.create({ + name: 'WORKSPACE_NAME_0909', + description: "WORKSPACE_DESCRIPTION", + defaults: { + metadata: { + environment: "production", + foo: "bar" + } + } + }) + console.log(workspace); + - lang: curl + label: Default + source: | + curl -X POST https://api.portkey.ai/v1/admin/workspaces \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "WORKSPACE_NAME_0909", + "description": "WORKSPACE_DESCRIPTION", + "defaults": { + "metadata": { + "environment": "production", + "foo": "bar" + } + } + }' + - lang: curl + label: Self-Hosted + source: | + curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "WORKSPACE_NAME_0909", + "description": "WORKSPACE_DESCRIPTION", + "defaults": { + "metadata": { + "environment": "production", + "foo": "bar" + } + } + }' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Add a workspace + workspace = portkey.admin.workspaces.create( + name='WORKSPACE_NAME_0909', + description="WORKSPACE_DESCRIPTION", + defaults={ + "metadata": { + "environment": "production", + "foo": "bar" + } + } + ) + + print(workspace) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const workspace = await portkey.admin.workspaces.create({ + name: 'WORKSPACE_NAME_0909', + description: "WORKSPACE_DESCRIPTION", + defaults: { + metadata: { + environment: "production", + foo: "bar" + } + } + }) + + console.log(workspace) + get: + tags: + - Workspaces + summary: Get All Workspaces + parameters: + - name: page_size + in: query + schema: + type: integer + example: '1' + - name: current_page + in: query + schema: + type: integer + example: '0' + - name: name + in: query + schema: + type: string + example: workspace + description: Workspace name to filter results, case sensitive + - name: exact_name + in: query + schema: + type: string + description: Workspace name filter with strict check + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/WorkspaceList' + example: + total: 2 + object: list + data: + - id: test-prod-ws-12345 + name: Test prod workspace + description: This is a production workspace + created_at: '2023-07-13 13:51:27' + last_updated_at: '2023-07-13 14:51:27' + object: workspace + - id: test-prod-ws-12345 + name: Test prod workspace + description: This is a production workspace + created_at: '2023-07-13 13:51:27' + last_updated_at: '2023-07-13 14:51:27' + object: workspace + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # List workspaces + workspaces = portkey.admin.workspaces.list() + + print(workspaces) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const workspaces=await portkey.admin.workspaces.list({}) + console.log(workspaces); + - lang: curl + label: Default + source: | + curl -X GET https://api.portkey.ai/v1/admin/workspaces + - lang: curl + label: Self-Hosted + source: | + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # List workspaces + workspaces = portkey.admin.workspaces.list() + + print(workspaces) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const workspaces=await portkey.admin.workspaces.list({}) + console.log(workspaces); + /admin/workspaces/{workspaceId}: + servers: *id001 + put: + tags: + - Workspaces + summary: Update Workspace + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: + type: string + defaults: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + input_guardrails: + type: array + items: + type: string + output_guardrails: + type: array + items: + type: string + usage_limits: + type: array + items: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + type: array + items: + $ref: '#/components/schemas/RateLimits' + example: + name: My Workspace + description: My Description + defaults: + metadata: + foo: bar + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Update workspace + workspace = portkey.admin.workspaces.update( + workspace_id='WORKSPACE_ID', + name='WORKSPACE 0909', + description='This is a test description', + defaults={ + "x": "y" + } + ) + + print(workspace) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const workspace=await portkey.admin.workspaces.update({ + workspaceId: 'WORKSPACE_ID', + name: 'WORKSPACE 0909', + description: 'This is a test description', + defaults: { + x: "y" + } + }) + console.log(workspace); + - lang: curl + label: Default + source: | + curl -X PUT "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name":"WORKSPACE 0909","description":"This is a test description","defaults":{"x":"y"}}' + - lang: curl + label: Self-Hosted + source: | + curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name":"WORKSPACE 0909","description":"This is a test description","defaults":{"x":"y"}}' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Update workspace + workspace = portkey.admin.workspaces.update( + workspace_id='WORKSPACE_ID', + name='WORKSPACE 0909', + description='This is a test description', + defaults={ + x: "y" + } + ) + + print(workspace) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const workspace=await portkey.admin.workspaces.update({ + workspaceId: 'WORKSPACE_ID', + name: 'WORKSPACE 0909', + description: 'This is a test description', + defaults: { + x: "y" + } + }) + console.log(workspace); + get: + tags: + - Workspaces + summary: Get workspace + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/WorkspaceWithUsers' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get workspace details + workspace = portkey.admin.workspaces.retrieve( + workspace_id='WORKSPACE_SLUG' + ) + + print(workspace) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const workspace=await portkey.admin.workspaces.retrieve({ + workspaceId: 'WORKSPACE_SLUG', + }) + console.log(workspace); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + baseUrl="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get workspace details + workspace = portkey.admin.workspaces.retrieve( + workspace_id='WORKSPACE_SLUG' + ) + + print(workspace) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const workspace=await portkey.admin.workspaces.retrieve({ + workspaceId: 'WORKSPACE_SLUG', + }) + console.log(workspace); + delete: + tags: + - Workspaces + summary: Delete a workspace + parameters: + - name: workspaceId + in: path + schema: + type: string + required: true + responses: + '200': + description: OK + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Delete workspace + result = portkey.admin.workspaces.delete( + workspace_id='WORKSPACE_SLUG' + ) + + print(result) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const workspace=await portkey.admin.workspaces.delete({ + workspaceId: 'WORKSPACE_SLUG', + }) + console.log(workspace); + - lang: curl + label: Default + source: | + curl -X DELETE "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete workspace + result = portkey.admin.workspaces.delete( + workspace_id='WORKSPACE_SLUG' + ) + + print(result) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const workspace=await portkey.admin.workspaces.delete({ + workspaceId: 'WORKSPACE_SLUG', + }) + console.log(workspace); + /audit-logs: + servers: *id001 + get: + tags: + - Audit Logs + summary: Get Audit Logs + parameters: + - name: start_time + in: query + required: true + description: Start time for filtering logs (ISO8601 format) + schema: + type: string + - name: end_time + in: query + required: true + description: End time for filtering logs (ISO8601 format) + schema: + type: string + - name: organisation_id + in: query + required: true + description: Organisation ID for filtering logs + schema: + type: string + - name: method + in: query + required: false + description: HTTP method for filtering logs + schema: + type: string + enum: + - POST + - PUT + - DELETE + - name: uri + in: query + required: false + description: URI path for filtering logs + schema: + type: string + - name: request_id + in: query + required: false + description: Request ID for filtering logs + schema: + type: string + - name: user_id + in: query + required: false + description: User ID for filtering logs + schema: + type: string + - name: user_type + in: query + required: false + description: Type of user for filtering logs + schema: + type: string + enum: + - user + - api_key + - name: workspace_id + in: query + required: false + description: Workspace ID for filtering logs + schema: + type: string + - name: response_status_code + in: query + required: false + description: HTTP response status code for filtering logs + schema: + type: integer + - name: resource_type + in: query + required: false + description: Resource type for filtering logs + schema: + type: string + - name: action + in: query + required: false + description: Action type for filtering logs + schema: + type: string + - name: client_ip + in: query + required: false + description: Client IP address for filtering logs + schema: + type: string + - name: country + in: query + required: false + description: Country for filtering logs + schema: + type: string + - name: current_page + in: query + required: false + description: Current page number for pagination + schema: + type: integer + minimum: 0 + - name: page_size + in: query + required: false + description: Number of items per page + schema: + type: integer + minimum: 0 + maximum: 100 + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/AuditLogObjectList' + /api-keys/{type}/{sub-type}: + servers: *id001 + post: + tags: + - Api-Keys + summary: Create API Keys + description: | + Creates a new API key. + parameters: + - name: type + in: path + schema: + type: string + enum: + - organisation + - workspace + required: true + - name: sub-type + in: path + schema: + type: string + enum: + - user + - service + required: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateApiKeyObject' + responses: + '200': + description: API key created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/CreateApiKeyResponse' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Create a new API key + api_key = portkey.api_keys.create( + name="API_KEY_NAME_0909", + type="organisation", + sub_type="service", + workspace_id="WORKSPACE_ID", + scopes=[ + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy" + ] + ) + + print(api_key) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const apiKey=await portkey.apiKeys.create({ + name:"API_KEY_NAME_0909", + type:"organisation", + "sub-type":"service", + workspace_id:"WORKSPACE_ID", + "scopes": [ + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy" + ] + }) + console.log(apiKey); + - lang: curl + label: Default + source: | + curl -X POST https://api.portkey.ai/v1/api-keys/organisation/service + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name":"API_KEY_NAME_0909", + "type":"organisation", + "sub-type":"service", + "workspace_id":"WORKSPACE_ID", + "scopes":[ + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy" + ] + }' + - lang: curl + label: Self-Hosted + source: | + curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/api-keys/organisation/service + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name":"API_KEY_NAME_0909", + "type":"organisation", + "sub-type":"service", + "workspace_id":"WORKSPACE_ID", + "scopes":[ + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy" + ] + }' + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const apiKey = await portkey.admin.apiKeys.create({ + name: "API_KEY_NAME_0909", + type: "organisation", + subType: "service", + workspaceId: "WORKSPACE_ID", + scopes: [ + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy" + ] + }) + console.log(apiKey); + - lang: python + label: Self-Hosted + source: | + from portkey import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + api_key = portkey.admin.api_keys.create( + name="API_KEY_NAME_0909", + type="organisation", + sub_type="service", + workspace_id="WORKSPACE_ID", + scopes=[ + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy" + ] + ) + print(api_key) + - lang: python + label: User API Key + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Create a user API key (requires user_id) + api_key = portkey.api_keys.create( + name="User API Key", + type="workspace", + sub_type="user", + workspace_id="WORKSPACE_ID", + user_id="USER_ID", # Required for user API keys + scopes=[ + "completions.write", + "logs.view" + ] + ) + + print(api_key) + - lang: javascript + label: User API Key + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const apiKey = await portkey.apiKeys.create({ + name: "User API Key", + type: "workspace", + "sub-type": "user", + workspace_id: "WORKSPACE_ID", + user_id: "USER_ID", // Required for user API keys + "scopes": [ + "completions.write", + "logs.view" + ] + }) + console.log(apiKey); + - lang: curl + label: User API Key + source: | + curl -X POST https://api.portkey.ai/v1/api-keys/workspace/user + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name":"User API Key", + "type":"workspace", + "sub-type":"user", + "workspace_id":"WORKSPACE_ID", + "user_id":"USER_ID", + "scopes":[ + "completions.write", + "logs.view" + ] + }' + /api-keys: + servers: + - url: https://api.portkey.ai/v1 + - url: https://SELF_HOSTED_CONTROL_PLANE_URL + get: + tags: + - Api-Keys + summary: Get All + parameters: + - name: page_size + in: query + schema: + type: integer + example: '1' + - name: current_page + in: query + schema: + type: integer + example: '0' + - name: workspace_id + in: query + schema: + type: string + example: ws-shared-123 + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/ApiKeyObjectList' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + api_keys = portkey.api_keys.list( + workspace_id="WORKSPACE_SLUG" + ) + + print(api_keys) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY" + }) + + const apiKey=await portkey.apiKeys.list({ + workspaceId:"WORKSPACE_SLUG" + }) + + console.log(apiKey); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/api-keys?workspace_id=WORKSPACE_SLUG" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/api-keys?workspace_id=WORKSPACE_SLUG" + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + api_keys = portkey.api_keys.list( + workspace_id="WORKSPACE_SLUG" + ) + + print(api_keys) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const apiKey=await portkey.apiKeys.list({ + workspaceId:"WORKSPACE_SLUG" + }) + + console.log(apiKey); + /api-keys/{id}: + servers: *id001 + put: + tags: + - Api-Keys + summary: Update API Keys + description: | + Updates an existing API key. The API key type (user vs service) and associated user_id cannot be changed after creation. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateApiKeyObject' + parameters: + - name: id + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Update the API key + updated_api_key = portkey.api_keys.update( + id="API_KEY_ID", + name="API_KEY_NAME_0909", + rate_limits=[ + { + "type": "requests", + "unit": "rpm", + "value": 100 + } + ], + scopes=[ + "organisation_users.create", "organisation_users.read", "organisation_users.update", + "organisation_users.delete", "organisation_users.list", + "organisation_service_api_keys.create", "organisation_service_api_keys.update", + "organisation_service_api_keys.read", "organisation_service_api_keys.delete", + "organisation_service_api_keys.list", "workspaces.delete", "workspaces.create", + "workspaces.read", "workspaces.update", "workspaces.list", "logs.export", + "logs.list", "logs.view", "configs.create", "configs.update", "configs.delete", + "configs.read", "configs.list", "virtual_keys.create", "virtual_keys.update", + "virtual_keys.delete", "virtual_keys.duplicate", "virtual_keys.read", + "virtual_keys.list", "virtual_keys.copy", "workspace_service_api_keys.create", + "workspace_service_api_keys.delete", "workspace_service_api_keys.update", + "workspace_service_api_keys.read", "workspace_service_api_keys.list", + "workspace_user_api_keys.create", "workspace_user_api_keys.delete", + "workspace_user_api_keys.update", "workspace_user_api_keys.read", + "workspace_user_api_keys.list", "workspace_users.create", "workspace_users.read", + "workspace_users.update", "workspace_users.delete", "workspace_users.list", + "analytics.view" + ] + ) + + print(updated_api_key) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const apiKey=await portkey.apiKeys.update({ + id:"API_KEY_ID", + name:"API_KEY_NAME_0909", + rate_limits:[ { + "type": "requests", + "unit": "rpm", + "value": 100 + }], + "scopes": [ + "organisation_users.create", + "organisation_users.read", + "organisation_users.update", + "organisation_users.delete", + "organisation_users.list", + "organisation_service_api_keys.create", + "organisation_service_api_keys.update", + "organisation_service_api_keys.read", + "organisation_service_api_keys.delete", + "organisation_service_api_keys.list", + "workspaces.delete", + "workspaces.create", + "workspaces.read", + "workspaces.update", + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.duplicate", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy", + "workspace_service_api_keys.create", + "workspace_service_api_keys.delete", + "workspace_service_api_keys.update", + "workspace_service_api_keys.read", + "workspace_service_api_keys.list", + "workspace_user_api_keys.create", + "workspace_user_api_keys.delete", + "workspace_user_api_keys.update", + "workspace_user_api_keys.read", + "workspace_user_api_keys.list", + "workspace_users.create", + "workspace_users.read", + "workspace_users.update", + "workspace_users.delete", + "workspace_users.list", + "analytics.view" + ], + + }) + console.log(apiKey); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/api-keys/{id}" + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name":"API_KEY_NAME_0909", + "rate_limits":[ + { + "type": "requests", + "unit": "rpm", + "value": 100 + } + ], + "scopes": [ + "organisation_users.create", + "organisation_users.read", + "organisation_users.update", + "organisation_users.delete", + "organisation_users.list", + "organisation_service_api_keys.create", + "organisation_service_api_keys.update", + "organisation_service_api_keys.read", + "organisation_service_api_keys.delete", + "organisation_service_api_keys.list", + "workspaces.delete", + "workspaces.create", + "workspaces.read", + "workspaces.update", + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.duplicate", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy", + "workspace_service_api_keys.create", + "workspace_service_api_keys.delete", + "workspace_service_api_keys.update", + "workspace_service_api_keys.read", + "workspace_service_api_keys.list", + "workspace_user_api_keys.create", + "workspace_user_api_keys.delete", + "workspace_user_api_keys.update", + "workspace_user_api_keys.read", + "workspace_user_api_keys.list", + "workspace_users.create", + "workspace_users.read", + "workspace_users.update", + "workspace_users.delete", + "workspace_users.list", + "analytics.view" + ] + }' + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/api-keys/{id}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name":"API_KEY_NAME_0909", + "rate_limits":[ + { + "type": "requests", + "unit": "rpm", + "value": 100 + } + ], + "scopes":[ + "organisation_users.create", + "organisation_users.read", + "organisation_users.update", + "organisation_users.delete", + "organisation_users.list", + "organisation_service_api_keys.create", + "organisation_service_api_keys.update", + "organisation_service_api_keys.read", + "organisation_service_api_keys.delete", + "organisation_service_api_keys.list", + "workspaces.delete", + "workspaces.create", + "workspaces.read", + "workspaces.update", + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.duplicate", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy", + "workspace_service_api_keys.create", + "workspace_service_api_keys.delete", + "workspace_service_api_keys.update", + "workspace_service_api_keys.read", + "workspace_service_api_keys.list", + "workspace_user_api_keys.create", + "workspace_user_api_keys.delete", + "workspace_user_api_keys.update", + "workspace_user_api_keys.read", + "workspace_user_api_keys.list", + "workspace_users.create", + "workspace_users.read", + "workspace_users.update", + "workspace_users.delete", + "workspace_users.list", + "analytics.view" + ] + }' + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Update the API key + updated_api_key = portkey.api_keys.update( + id="API_KEY_ID", + name="API_KEY_NAME_0909", + rate_limits=[ + { + "type": "requests", + "unit": "rpm", + "value": 100 + } + ], + scopes=[ + "organisation_users.create", "organisation_users.read", "organisation_users.update", + "organisation_users.delete", "organisation_users.list", + "organisation_service_api_keys.create", "organisation_service_api_keys.update", + "organisation_service_api_keys.read", "organisation_service_api_keys.delete", + "organisation_service_api_keys.list", "workspaces.delete", "workspaces.create", + "workspaces.read", "workspaces.update", "workspaces.list", "logs.export", + "logs.list", "logs.view", "configs.create", "configs.update", "configs.delete", + "configs.read", "configs.list", "virtual_keys.create", "virtual_keys.update", + "virtual_keys.delete", "virtual_keys.duplicate", "virtual_keys.read", + "virtual_keys.list", "virtual_keys.copy", "workspace_service_api_keys.create", + "workspace_service_api_keys.delete", "workspace_service_api_keys.update", + "workspace_service_api_keys.read", "workspace_service_api_keys.list", + "workspace_user_api_keys.create", "workspace_user_api_keys.delete", + "workspace_user_api_keys.update", "workspace_user_api_keys.read", + "workspace_user_api_keys.list", "workspace_users.create", "workspace_users.read", + "workspace_users.update", "workspace_users.delete", "workspace_users.list", + "analytics.view" + ] + ) + + print(updated_api_key) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const apiKey=await portkey.apiKeys.update({ + id:"API_KEY_ID", + name:"API_KEY_NAME_0909", + rate_limits:[ { + "type": "requests", + "unit": "rpm", + "value": 100 + }], + "scopes": [ + "organisation_users.create", + "organisation_users.read", + "organisation_users.update", + "organisation_users.delete", + "organisation_users.list", + "organisation_service_api_keys.create", + "organisation_service_api_keys.update", + "organisation_service_api_keys.read", + "organisation_service_api_keys.delete", + "organisation_service_api_keys.list", + "workspaces.delete", + "workspaces.create", + "workspaces.read", + "workspaces.update", + "workspaces.list", + "logs.export", + "logs.list", + "logs.view", + "configs.create", + "configs.update", + "configs.delete", + "configs.read", + "configs.list", + "virtual_keys.create", + "virtual_keys.update", + "virtual_keys.delete", + "virtual_keys.duplicate", + "virtual_keys.read", + "virtual_keys.list", + "virtual_keys.copy", + "workspace_service_api_keys.create", + "workspace_service_api_keys.delete", + "workspace_service_api_keys.update", + "workspace_service_api_keys.read", + "workspace_service_api_keys.list", + "workspace_user_api_keys.create", + "workspace_user_api_keys.delete", + "workspace_user_api_keys.update", + "workspace_user_api_keys.read", + "workspace_user_api_keys.list", + "workspace_users.create", + "workspace_users.read", + "workspace_users.update", + "workspace_users.delete", + "workspace_users.list", + "analytics.view" + ], + + }) + console.log(apiKey); + get: + tags: + - Api-Keys + summary: Get API Keys + parameters: + - name: id + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + $ref: '#/components/schemas/ApiKeyObject' + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Get API keys + api_keys = portkey.api_keys.retrieve( + id="API_KEY_ID" + ) + + print(api_keys) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const apiKey=await portkey.apiKeys.retrieve({ + id:"API_KEY_ID" + }) + + console.log(apiKey); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/api_keys/{id}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/api_keys/{id}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Get API keys + api_keys = portkey.api_keys.retrieve( + id="API_KEY_ID" + ) + + print(api_keys) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const apiKey=await portkey.apiKeys.retrieve({ + id:"API_KEY_ID" + }) + + console.log(apiKey); + delete: + tags: + - Api-Keys + summary: Remove an API Key + parameters: + - name: id + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + ) + + # Delete the API key + result = portkey.api_keys.delete( + id="API_KEY_ID" + ) + + print(result) + - lang: javascript + label: Default + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) + + const apiKey=await portkey.apiKeys.delete({ + id:"API_KEY_ID" + }) + console.log(apiKey); + - lang: curl + label: Default + source: | + curl -X DELETE "https://api.portkey.ai/v1/api_keys/{id}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X DELETE "SELF_HOSTED_CONTROL_PLANE_URL/api_keys/{id}" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: python + label: Self-Hosted + source: | + from portkey_ai import Portkey + + # Initialize the Portkey client + portkey = Portkey( + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" + ) + + # Delete the API key + result = portkey.api_keys.delete( + id="API_KEY_ID" + ) + + print(result) + - lang: javascript + label: Self-Hosted + source: | + import { Portkey } from "portkey-ai"; + + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const apiKey=await portkey.apiKeys.delete({ + id:"API_KEY_ID" + }) + console.log(apiKey); + /policies/usage-limits: + post: + tags: + - Usage Limits Policies + summary: Create Usage Limits Policy + description: Create a new usage limits policy to control total usage (cost or tokens) over a period. + operationId: createUsageLimitsPolicy + security: + - Portkey-Key: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUsageLimitsPolicyRequest' + examples: + monthlyCostLimit: + summary: Monthly Cost Limit per API Key + value: + name: Monthly Cost Limit per API Key + conditions: + - key: workspace_id + value: workspace-123 + group_by: + - key: api_key + type: cost + credit_limit: 1000.0 + alert_threshold: 800.0 + periodic_reset: monthly + tokenLimit: + summary: Token Limit per User + value: + name: Token Limit per User + conditions: + - key: workspace_id + value: workspace-123 + group_by: + - key: metadata.user_id + type: tokens + credit_limit: 1000000 + periodic_reset: weekly + responses: + '200': + description: Policy created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePolicyResponse' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + get: + tags: + - Usage Limits Policies + summary: List Usage Limits Policies + description: List all usage limits policies with optional filtering. + operationId: listUsageLimitsPolicies + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/WorkspaceIdQuery' + - name: status + in: query + description: Filter by status + required: false + schema: + type: string + enum: + - active + - archived + default: active + - name: type + in: query + description: Filter by policy type + required: false + schema: + type: string + enum: + - cost + - tokens + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/CurrentPage' + responses: + '200': + description: List of usage limits policies + content: + application/json: + schema: + $ref: '#/components/schemas/UsageLimitsPolicyListResponse' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + /policies/usage-limits/{policyUsageLimitsId}: + get: + tags: + - Usage Limits Policies + summary: Get Usage Limits Policy + description: Get a single usage limits policy by ID. + operationId: getUsageLimitsPolicy + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/PolicyUsageLimitsId' + - name: status + in: query + description: Filter by status + required: false + schema: + type: string + enum: + - active + - archived + default: active + - name: include_usage + in: query + description: Include usage information for each value key + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Usage limits policy details + content: + application/json: + schema: + $ref: '#/components/schemas/UsageLimitsPolicyResponse' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + put: + tags: + - Usage Limits Policies + summary: Update Usage Limits Policy + description: Update an existing usage limits policy. + operationId: updateUsageLimitsPolicy + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/PolicyUsageLimitsId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUsageLimitsPolicyRequest' + example: + credit_limit: 2000.0 + alert_threshold: 1500.0 + reset_usage_for_value: api-key-123 + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + delete: + tags: + - Usage Limits Policies + summary: Delete Usage Limits Policy + description: Archive (soft delete) a usage limits policy. + operationId: deleteUsageLimitsPolicy + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/PolicyUsageLimitsId' + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + /policies/rate-limits: + post: + tags: + - Rate Limits Policies + summary: Create Rate Limits Policy + description: Create a new rate limits policy to control the rate of requests or tokens consumed per minute, hour, or + day. + operationId: createRateLimitsPolicy + security: + - Portkey-Key: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRateLimitsPolicyRequest' + examples: + requestsPerMinute: + summary: 100 Requests per Minute per API Key + value: + name: 100 RPM per API Key + conditions: + - key: workspace_id + value: workspace-123 + group_by: + - key: api_key + type: requests + unit: rpm + value: 100 + tokensPerHour: + summary: 10K Tokens per Hour per User + value: + name: 10K Tokens per Hour per User + conditions: + - key: workspace_id + value: workspace-123 + group_by: + - key: metadata.user_id + type: tokens + unit: rph + value: 10000 + responses: + '200': + description: Policy created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePolicyResponse' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '500': + description: Server error + get: + tags: + - Rate Limits Policies + summary: List Rate Limits Policies + description: List all rate limits policies with optional filtering. + operationId: listRateLimitsPolicies + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/WorkspaceIdQuery' + - name: status + in: query + description: Filter by status + required: false + schema: + type: string + enum: + - active + - archived + default: active + - name: type + in: query + description: Filter by policy type + required: false + schema: + type: string + enum: + - requests + - tokens + - name: unit + in: query + description: Filter by rate unit + required: false + schema: + type: string + enum: + - rpm + - rph + - rpd + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/CurrentPage' + responses: + '200': + description: List of rate limits policies + content: + application/json: + schema: + $ref: '#/components/schemas/RateLimitsPolicyListResponse' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + /policies/rate-limits/{rateLimitsPolicyId}: + get: + tags: + - Rate Limits Policies + summary: Get Rate Limits Policy + description: Get a single rate limits policy by ID. + operationId: getRateLimitsPolicy + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/RateLimitsPolicyId' + - name: status + in: query + description: Filter by status + required: false + schema: + type: string + enum: + - active + - archived + default: active + responses: + '200': + description: Rate limits policy details + content: + application/json: + schema: + $ref: '#/components/schemas/RateLimitsPolicyResponse' + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + put: + tags: + - Rate Limits Policies + summary: Update Rate Limits Policy + description: Update an existing rate limits policy. + operationId: updateRateLimitsPolicy + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/RateLimitsPolicyId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateRateLimitsPolicyRequest' + example: + value: 200 + unit: rph + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error + delete: + tags: + - Rate Limits Policies + summary: Delete Rate Limits Policy + description: Delete a rate limits policy. + operationId: deleteRateLimitsPolicy + security: + - Portkey-Key: [] + parameters: + - $ref: '#/components/parameters/RateLimitsPolicyId' + responses: + '200': + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + example: {} + '400': + description: Bad request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Policy not found + '500': + description: Server error +components: + schemas: + ModelUpdateRequest: + type: object + required: + - slug + - enabled + properties: + slug: + type: string + description: Model slug identifier + enabled: + type: boolean + description: Whether to enable the model + is_custom: + type: boolean + nullable: true + description: Whether this is a custom model + is_finetune: + type: boolean + nullable: true + description: Whether this is a fine-tuned model + base_model_slug: + type: string + nullable: true + description: Base model slug for fine-tuned models + pricing_config: + $ref: '#/components/schemas/PricingConfig' + PromptVersionSummary: + type: object + properties: + id: + type: string + format: uuid + prompt_id: + type: string + format: uuid + prompt_template: + type: object + prompt_version: + type: number + prompt_description: + type: string + label_id: + type: string + format: uuid + created_at: + type: string + format: date-time + status: + type: string + enum: + - active + - archived + object: + type: string + enum: + - prompt + BasicParameters: + type: object + description: Basic parameters with no specific requirements + additionalProperties: true + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + required: + - type + PatronusParameters: + type: object + properties: + redact: + type: boolean + description: Whether to redact detected content + default: false + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + PromptPartial: + type: object + properties: + id: + type: string + format: uuid + slug: + type: string + name: + type: string + collection_id: + type: string + format: uuid + string: + type: string + version: + type: number + version_description: + type: string + prompt_partial_version_id: + type: string + format: uuid + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + status: + type: string + enum: + - active + MistralModerationParameters: + type: object + required: + - categories + properties: + categories: + type: array + items: + type: string + enum: + - sexual + - hate_and_discrimination + - violence_and_threats + - dangerous_and_criminal_content + - selfharm + - health + - financial + - law + - pii + description: Categories that should NOT be allowed + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + CharacterCountParameters: + type: object + properties: + minCharacters: + type: number + description: Minimum number of characters to allow + default: 0 + maxCharacters: + type: number + description: Maximum number of characters to allow + default: 9999999 + not: + type: boolean + description: If true, the verdict will be inverted + default: false + Error: + type: object + properties: + code: + type: string + nullable: true + message: + type: string + nullable: false + param: + type: string + nullable: true + type: + type: string + nullable: false + required: + - type + - message + - param + - code + AzureAIConfiguration: + type: object + required: + - azure_foundry_url + - azure_auth_mode + properties: + azure_auth_mode: + type: string + enum: + - default + - entra + - managed + description: Authentication mode for Azure AI + azure_foundry_url: + type: string + description: Azure AI Foundry URL + azure_api_version: + type: string + maxLength: 30 + description: Azure API version + azure_deployment_name: + type: string + description: Azure deployment name + azure_entra_tenant_id: + type: string + description: Azure AD tenant ID (required for entra auth) + azure_entra_client_id: + type: string + description: Azure AD client ID (required for entra auth) + azure_entra_client_secret: + type: string + description: Azure AD client secret (required for entra auth) + azure_managed_client_id: + type: string + description: Managed identity client ID (optional for managed auth) + Providers: + type: object + properties: + name: + type: string + example: Open AI Workspace + integration_id: + type: string + note: + type: string + nullable: true + example: randomness + status: + type: string + enum: + - active + - exhausted + - expired + usage_limits: + $ref: '#/components/schemas/UsageLimits' + reset_usage: + type: number + nullable: true + example: 0 + created_at: + type: string + format: date-time + slug: + type: string + rate_limits: + type: array + items: + $ref: '#/components/schemas/RateLimits' + nullable: true + expires_at: + type: string + format: date-time + object: + type: string + enum: + - provider + WorkspaceInviteRole: + type: string + enum: + - admin + - member + - manager + IntegrationModelsResponse: + type: object + properties: + total: + type: integer + description: Total number of models + models: + type: array + items: + $ref: '#/components/schemas/IntegrationModel' + GuardrailDetails: + allOf: + - $ref: '#/components/schemas/GuardrailSummary' + - type: object + properties: + checks: + type: array + description: Array of configured guardrail checks + items: + $ref: '#/components/schemas/GuardrailCheck' + actions: + $ref: '#/components/schemas/GuardrailActions' + AcuvityScanParameters: + type: object + properties: + prompt_injection: + type: boolean + description: Enable prompt injection detection + default: true + prompt_injection_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for prompt injection detection + default: 0.5 + toxic: + type: boolean + description: Enable toxicity detection + default: true + toxic_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for toxicity detection + default: 0.5 + jail_break: + type: boolean + description: Enable jailbreak detection + default: true + jail_break_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for jailbreak detection + default: 0.5 + malicious_url: + type: boolean + description: Enable malicious URL detection + default: true + malicious_url_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for malicious URL detection + default: 0.5 + biased: + type: boolean + description: Enable bias detection + default: true + biased_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for bias detection + default: 0.5 + harmful: + type: boolean + description: Enable harmful content detection + default: true + harmful_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for harmful content detection + default: 0.5 + language: + type: boolean + description: Enable language check + default: true + language_values: + type: string + enum: + - english + - chinese + - spanish + - french + - german + - japanese + - gibberish + description: Language to check + default: english + pii: + type: boolean + description: Enable PII detection + default: true + pii_redact: + type: boolean + description: Enable PII redaction + default: false + pii_categories: + type: array + items: + type: string + enum: + - email_address + - ssn + - person + - aba_routing_number + - address + - bank_account + - bitcoin_wallet + - credit_card + - driver_license + - itin_number + - location + - medical_license + - money_amount + - passport_number + - phone_number + description: PII categories to detect + secrets: + type: boolean + description: Enable secrets detection + default: true + secrets_redact: + type: boolean + description: Enable secrets redaction + default: false + secrets_categories: + type: array + items: + type: string + enum: + - credentials + - aws_secret_key + - github + - openai + - stripe + - jwt + - private_key + description: Secret categories to detect + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + SuccessInvite: + type: object + required: + - id + - invite_link + properties: + id: + type: string + invite_link: + type: string + example: + id: a286286b-633d-4c4f-bddb-86b84a50a25c + invite_link: https://app.portkey.ai/invite_id + ApiKeyObject: + type: object + properties: + id: + type: string + format: uuid + example: f47ac10b-58cc-4372-a567-0e02b2c3d479 + key: + type: string + example: Xk*******S4 + name: + type: string + example: Development API Key + description: + type: string + example: API key for development environment + type: + type: string + enum: + - organisation-service + - workspace-service + - workspace-user + example: organisation-service + organisation_id: + type: string + format: uuid + example: a1b2c3d4-e5f6-4a5b-8c7d-9e0f1a2b3c4d + workspace_id: + type: string + example: ws-myworkspace + user_id: + type: string + format: uuid + example: c3d4e5f6-a7b8-6c7d-0e1f-2a3b4c5d6e7f + status: + type: string + enum: + - active + - exhausted + example: active + created_at: + type: string + format: date-time + example: '2023-09-15T10:30:00Z' + last_updated_at: + type: string + format: date-time + example: '2023-09-15T10:30:00Z' + creation_mode: + type: string + enum: + - ui + - api + - auto + example: ui + rate_limits: + type: array + items: + type: object + properties: + type: + type: string + example: requests + unit: + type: string + example: rpm + value: + type: integer + example: 100 + usage_limits: + $ref: '#/components/schemas/UsageLimits' + reset_usage: + type: number + example: 0 + scopes: + type: array + items: + type: string + example: + - completions.write + defaults: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + description: Key-value metadata pairs + example: + environment: development + team: backend + config_id: + type: string + example: config-abc + alert_emails: + type: array + items: + type: string + format: email + example: foo@bar.com + expires_at: + type: string + format: date-time + object: + type: string + enum: + - api-key + example: api-key + IntegrationDetailResponse: + allOf: + - $ref: '#/components/schemas/IntegrationList' + - type: object + properties: + masked_key: + type: string + description: Masked API key + configurations: + type: object + description: | + Provider-specific configuration object + + **⚠️ Security Note - Response Masking:** + When retrieving integration details, sensitive fields are automatically masked: + - Sensitive fields get a `masked_` prefix (e.g., `client_secret` → `masked_client_secret`) + - Non-sensitive fields (IDs, URLs, regions, etc.) remain unchanged + oneOf: + - $ref: '#/components/schemas/OpenAIConfiguration' + title: OpenAI + - $ref: '#/components/schemas/AzureOpenAIConfiguration' + title: Azure OpenAI + - $ref: '#/components/schemas/BedrockConfiguration' + title: AWS Bedrock + - $ref: '#/components/schemas/VertexAIConfiguration' + title: Vertex AI + - $ref: '#/components/schemas/AzureAIConfiguration' + title: Azure AI + - $ref: '#/components/schemas/WorkersAIConfiguration' + title: Workers AI + - $ref: '#/components/schemas/SageMakerConfiguration' + title: AWS Sagemaker + - $ref: '#/components/schemas/HuggingFaceConfiguration' + title: Hugginface + - $ref: '#/components/schemas/CortexConfiguration' + title: Cortex + - $ref: '#/components/schemas/CustomHostConfiguration' + title: Custom Base URL + global_workspace_access_settings: + type: object + nullable: true + $ref: '#/components/schemas/GlobalWorkspaceAccess' + description: Global workspace access configuration + allow_all_models: + type: boolean + description: Whether new models will be enabled by default + workspace_count: + type: integer + description: Number of workspaces with access to this integration + Condition: + type: object + required: + - key + - value + properties: + key: + type: string + description: | + Condition key. Valid values: + - `api_key` - Apply to a specific API key + - `organisation_id` - Apply to an organization + - `workspace_id` - Apply to a workspace + - `metadata.*` - Apply based on custom metadata fields (e.g., `metadata.user_id`, `metadata.team`) + example: workspace_id + value: + type: string + description: Condition value + example: workspace-123 + InviteList: + type: object + properties: + object: + type: string + enum: + - list + total: + type: integer + data: + type: array + items: + $ref: '#/components/schemas/Invite' + ChatCompletionFunctionCallOption: + type: object + description: | + Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + properties: + name: + type: string + description: The name of the function to call. + required: + - name + ModelWhitelistParameters: + type: object + required: + - models + properties: + models: + type: array + items: + type: string + description: List of allowed models + GuardrailSummary: + type: object + required: + - id + - name + - slug + - created_at + - last_updated_at + - owner_id + properties: + id: + type: string + description: Unique identifier of the guardrail + name: + type: string + description: Name of the guardrail + slug: + type: string + description: URL-friendly slug + organisation_id: + type: string + format: uuid + description: Organisation UUID + workspace_id: + type: string + format: uuid + nullable: true + description: Workspace UUID (null for organisation-level guardrails) + status: + type: string + enum: + - active + - archived + description: Current status of the guardrail + created_at: + type: string + format: date-time + description: Creation timestamp + last_updated_at: + type: string + format: date-time + description: Last update timestamp + owner_id: + type: string + format: uuid + description: UUID of the user who created the guardrail + updated_by: + type: string + format: uuid + nullable: true + description: UUID of the user who last updated the guardrail + AzureDeploymentConfig: + type: object + required: + - azure_api_version + - azure_deployment_name + - azure_model_slug + properties: + alias: + type: string + description: Alias for the deployment + azure_api_version: + type: string + maxLength: 30 + description: Azure API version + azure_deployment_name: + type: string + description: Azure deployment name + is_default: + type: boolean + default: false + description: Whether this is the default deployment + azure_model_slug: + type: string + description: Azure model slug + ChatCompletionStreamOptions: + description: | + Options for streaming response. Only set this when you set `stream: true`. + type: object + nullable: true + default: null + properties: + include_usage: + type: boolean + description: | + If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value. + ChatCompletionFunctions: + type: object + deprecated: true + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with + a maximum length of 64. + parameters: + $ref: '#/components/schemas/FunctionParameters' + required: + - name + PortkeyLanguageParameters: + type: object + properties: + language: + type: string + enum: + - eng_Latn + - zho_Hans + - spa_Latn + - ara_Arab + - por_Latn + - ind_Latn + - fra_Latn + - jpn_Jpan + - rus_Cyrl + - deu_Latn + - kor_Hang + - tur_Latn + - ita_Latn + - pes_Arab + - pol_Latn + - vie_Latn + - nld_Latn + - hin_Deva + - tha_Thai + - heb_Hebr + - ben_Beng + - swe_Latn + - ces_Latn + - ron_Latn + - ell_Grek + - ukr_Cyrl + - dan_Latn + - fin_Latn + - nor_Latn + - hun_Latn + - cat_Latn + - bul_Cyrl + - msa_Latn + - hrv_Latn + - arb_Latn + - slk_Latn + - lit_Latn + - lav_Latn + - srp_Cyrl + - slv_Latn + - est_Latn + - urd_Arab + - fil_Latn + - aze_Latn + - tam_Taml + - tel_Telu + - mar_Deva + - kan_Knda + - fas_Arab + description: Language that should be allowed in content + not: + type: boolean + description: If true, the verdict will be inverted + default: false + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + WordCountParameters: + type: object + properties: + minWords: + type: number + description: Minimum number of words to allow + default: 0 + maxWords: + type: number + description: Maximum number of words to allow + default: 99999 + not: + type: boolean + description: If true, the verdict will be inverted + default: false + Invite: + type: object + properties: + object: + type: string + example: invite + id: + type: string + format: uuid + email: + type: string + format: email + role: + type: string + enum: + - admin + - member + created_at: + type: string + format: date-time + expires_at: + type: string + format: date-time + accepted_at: + type: string + format: date-time + status: + type: string + enum: + - pending + - cancelled + - accepted + - expired + invited_by: + type: string + format: uuid + UpdateRateLimitsPolicyRequest: + type: object + properties: + name: + type: string + maxLength: 255 + description: Policy name + unit: + type: string + enum: + - rpm + - rph + - rpd + description: Rate unit + value: + type: number + description: Rate limit value + IntegrationWorkspace: + type: object + properties: + id: + type: string + description: Workspace ID + example: ws-my-team-1234 + enabled: + type: boolean + description: Whether the workspace has access + usage_limits: + type: array + nullable: true + items: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + type: array + nullable: true + items: + $ref: '#/components/schemas/RateLimits' + ChatCompletionRequestMessageContentPartText: + type: object + title: Text content part + properties: + type: + type: string + enum: + - text + description: The type of the content part. + text: + type: string + description: The text content. + required: + - type + - text + ChatCompletionMessageContentPartRedactedThinking: + type: object + title: Redacted thinking content part + properties: + type: + type: string + enum: + - redacted_thinking + description: The type of the content part. + data: + type: string + description: The redacted thinking content. + required: + - type + - data + PromptfooParameters: + type: object + properties: + redact: + type: boolean + description: Whether to redact detected content + default: false + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + RequiredMetadataKeysParameters: + type: object + required: + - metadataKeys + - operator + properties: + metadataKeys: + type: array + items: + type: string + description: Metadata keys to check for + operator: + type: string + enum: + - all + - any + - none + description: Operator to use for key checking + default: all + UpdateIntegrationRequest: + type: object + properties: + name: + type: string + description: Human-readable name for the integration + example: Production OpenAI + key: + type: string + description: API key for the provider (if required) + example: sk-... + description: + type: string + description: Optional description of the integration + example: Production OpenAI integration for customer-facing applications + configurations: + type: object + description: Provider-specific configuration object + oneOf: + - $ref: '#/components/schemas/OpenAIConfiguration' + title: OpenAI + - $ref: '#/components/schemas/AzureOpenAIConfiguration' + title: Azure OpenAI + - $ref: '#/components/schemas/BedrockConfiguration' + title: AWS Bedrock + - $ref: '#/components/schemas/VertexAIConfiguration' + title: Vertex AI + - $ref: '#/components/schemas/AzureAIConfiguration' + title: Azure AI + - $ref: '#/components/schemas/WorkersAIConfiguration' + title: Workers AI + - $ref: '#/components/schemas/SageMakerConfiguration' + title: AWS Sagemaker + - $ref: '#/components/schemas/HuggingFaceConfiguration' + title: Hugginface + - $ref: '#/components/schemas/CortexConfiguration' + title: Cortex + - $ref: '#/components/schemas/CustomHostConfiguration' + title: Custom Base URL + AzureContentSafetyParameters: + type: object + properties: + blocklistNames: + type: array + items: + type: string + description: Array of blocklist names to check against + default: [] + apiVersion: + type: string + description: API version for the Content Safety API + default: '2024-09-01' + severity: + type: number + description: Severity threshold for the Content Safety API + default: 2 + categories: + type: array + items: + type: string + enum: + - Hate + - SelfHarm + - Sexual + - Violence + description: Categories to check against + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + ChatCompletionRequestMessage: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' + - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' + - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' + - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' + - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' + - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' + x-oaiExpandable: true + ResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + type: boolean + nullable: true + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + required: + - name + required: + - type + - json_schema + RateLimits: + type: object + properties: + type: + type: string + enum: + - requests + - tokens + unit: + type: string + enum: + - rpd + - rph + - rpm + value: + type: integer + Prompt: + type: object + properties: + id: + type: string + format: uuid + slug: + type: string + name: + type: string + collection_id: + type: string + format: uuid + string: + type: string + parameters: + type: object + prompt_version: + type: number + prompt_version_id: + type: string + format: uuid + prompt_version_status: + type: string + enum: + - active + - archived + prompt_version_description: + type: string + prompt_version_label_id: + type: string + format: uuid + virtual_key: + type: string + model: + type: string + functions: + type: array + items: + type: object + tools: + type: array + items: + type: object + tool_choice: + type: object + template_metadata: + type: object + is_raw_template: + type: boolean + status: + type: string + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + WorkspaceInvite: + type: object + required: + - id + - role + properties: + id: + type: string + description: Workspace Slug + role: + $ref: '#/components/schemas/WorkspaceInviteRole' + PatronusCustomParameters: + type: object + required: + - profile + properties: + profile: + type: string + description: Custom evaluator profile name (e.g., system:is-concise) + timeout: + type: number + description: Timeout in milliseconds + default: 15000 + PortkeyModerationParameters: + type: object + required: + - categories + properties: + categories: + type: array + items: + type: string + enum: + - hate + - hate/threatening + - harassment + - harassment/threatening + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + description: Categories that should NOT be allowed + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + PANWPrismaParameters: + type: object + required: + - profile_name + properties: + profile_name: + type: string + description: Prisma profile name + ai_model: + type: string + description: AI model identifier + app_user: + type: string + description: Application user identifier + WorkspaceMember: + type: object + properties: + object: + type: string + example: workspace-user + enum: + - workspace-user + id: + type: string + format: uuid + example: 25afb7bd-f98a-11ee-85fe-0e27d7367987 + first_name: + type: string + example: John + last_name: + type: string + example: Doe + org_role: + type: string + example: member + enum: + - admin + - member + - owner + role: + type: string + example: member + enum: + - admin + - member + - manager + created_at: + type: string + example: 2024-01-01 00:00:00+00:00 + format: date-time + last_updated_at: + type: string + example: 2024-01-01 00:00:00+00:00 + format: date-time + status: + type: string + example: active + enum: + - active + RegexMatchParameters: + type: object + required: + - rule + properties: + rule: + type: string + description: Regex pattern to match + not: + type: boolean + description: If true, the check will fail when the regex pattern matches + default: false + UpdateApiKeyObject: + type: object + properties: + name: + type: string + example: Development API Key + description: + type: string + example: API key for development environment + rate_limits: + type: array + items: + type: object + properties: + type: + type: string + example: requests + unit: + type: string + example: rpm + value: + type: integer + example: 100 + usage_limits: + $ref: '#/components/schemas/UsageLimits' + scopes: + type: array + items: + type: string + example: + - completions.write + defaults: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + description: Key-value metadata pairs + example: + environment: development + team: backend + config_id: + type: string + example: config-abc + alert_emails: + type: array + items: + type: string + format: email + example: foo@bar.com + HuggingFaceConfiguration: + type: object + properties: + huggingface_base_url: + type: string + description: Custom Hugging Face base URL + BulkUpdateModelsRequest: + type: object + required: + - models + properties: + models: + type: array + items: + $ref: '#/components/schemas/ModelUpdateRequest' + allow_all_models: + type: boolean + description: Whether to allow all models by default + CreateApiKeyObject: + type: object + properties: + name: + type: string + example: Development API Key + description: + type: string + example: API key for development environment + workspace_id: + type: string + example: ws-myworkspace + user_id: + type: string + format: uuid + description: '**Required** when sub-type path parameter is ''user''. Not required when sub-type is ''service''.' + example: c3d4e5f6-a7b8-6c7d-0e1f-2a3b4c5d6e7f + rate_limits: + type: array + items: + type: object + properties: + type: + type: string + example: requests + unit: + type: string + example: rpm + value: + type: integer + example: 100 + usage_limits: + $ref: '#/components/schemas/UsageLimits' + scopes: + type: array + items: + type: string + example: + - completions.write + defaults: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + description: Key-value metadata pairs + example: + environment: development + team: backend + config_id: + type: string + example: config-abc + alert_emails: + type: array + items: + type: string + format: email + example: foo@bar.com + expires_at: + type: string + format: date-time + CreateApiKeyResponse: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier for the created API key + key: + type: string + description: The API key value (only shown once at creation) + object: + type: string + enum: + - api-key + example: api-key + ValueKeyUsage: + type: object + properties: + current_usage: + type: number + description: Current usage value + status: + type: string + enum: + - active + - exhausted + description: Usage status + is_threshold_alerts_sent: + type: boolean + description: Whether threshold alerts have been sent + is_exhausted_alerts_sent: + type: boolean + description: Whether exhausted alerts have been sent + WorkspaceList: + type: object + properties: + total: + type: integer + example: 2 + object: + type: string + enum: + - list + data: + type: array + items: + $ref: '#/components/schemas/Workspace' + UsageLimitsPolicyListResponse: + type: object + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: '#/components/schemas/UsageLimitsPolicy' + total: + type: integer + description: Total number of policies + ResponseFormatJsonObject: + type: object + title: JSON object + description: | + JSON object response format. An older method of generating JSON responses. + Using `json_schema` is recommended for models that support it. Note that the + model will not generate JSON without a system or user message instructing it + to do so. + properties: + type: + type: string + description: The type of response format being defined. Always `json_object`. + enum: + - json_object + x-stainless-const: true + required: + - type + ChatCompletionResponseMessage: + type: object + description: A chat completion message generated by the model. + properties: + content: + type: string + description: The contents of the message. + nullable: true + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + role: + type: string + enum: + - assistant + description: The role of the author of this message. + function_call: + type: object + deprecated: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, + as generated by the model. + properties: + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the + model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. + Validate the arguments in your code before calling your function. + name: + type: string + description: The name of the function to call. + required: + - name + - arguments + content_blocks: + nullable: true + type: array + description: The content blocks of the message. This is only present for certain providers with strict-open-ai-compliance + flag set to false + items: + type: object + $ref: '#/components/schemas/ChatCompletionMessageContentBlock' + required: + - role + - content + EndsWithParameters: + type: object + required: + - suffix + properties: + suffix: + type: string + description: Suffix to check for + not: + type: boolean + description: If true, the verdict will be inverted + default: false + CreateUsageLimitsPolicyRequest: + type: object + required: + - conditions + - group_by + - type + - credit_limit + properties: + name: + type: string + maxLength: 255 + description: Policy name + example: Monthly Cost Limit + conditions: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/Condition' + description: Array of conditions that define which requests the policy applies to + group_by: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/GroupBy' + description: Array of group by fields that define how usage is aggregated + type: + type: string + enum: + - cost + - tokens + description: Policy type + credit_limit: + type: number + minimum: 0 + description: Maximum usage allowed + alert_threshold: + type: number + nullable: true + minimum: 0 + description: Threshold at which to send alerts. Must be less than credit_limit. + periodic_reset: + type: string + nullable: true + enum: + - monthly + - weekly + description: Reset period. If not provided, limit is cumulative. + workspace_id: + type: string + description: Workspace ID or slug. Required if not using API key authentication. + organisation_id: + type: string + format: uuid + description: Organization ID. Required if not using API key authentication. + CreateRateLimitsPolicyRequest: + type: object + required: + - conditions + - group_by + - type + - unit + - value + properties: + name: + type: string + maxLength: 255 + description: Policy name + example: 100 Requests per Minute + conditions: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/Condition' + description: Array of conditions that define which requests the policy applies to + group_by: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/GroupBy' + description: Array of group by fields that define how usage is aggregated + type: + type: string + enum: + - requests + - tokens + description: Policy type + unit: + type: string + enum: + - rpm + - rph + - rpd + description: | + Rate unit: + - `rpm` - Requests/Tokens per minute + - `rph` - Requests/Tokens per hour + - `rpd` - Requests/Tokens per day + value: + type: number + description: Rate limit value + workspace_id: + type: string + description: Workspace ID or slug. Required if not using API key authentication. + organisation_id: + type: string + format: uuid + description: Organization ID. Required if not using API key authentication. + AuditLogObjectList: + type: object + properties: + records: + type: array + items: + type: object + properties: + timestamp: + type: string + description: Timestamp of when the action occurred + method: + type: string + enum: + - POST + - PUT + - DELETE + description: HTTP method used for the request + uri: + type: string + description: URI path that was accessed + request_id: + type: string + description: Unique ID of the request + request_body: + type: string + description: JSON string of the request body + query_params: + type: string + description: JSON string of the query parameters + request_headers: + type: string + description: JSON string of the request headers (partially masked) + user_id: + type: string + format: uuid + description: ID of the user who made the request + user_type: + type: string + enum: + - user + - api_key + description: Type of user who made the request + organisation_id: + type: string + format: uuid + description: ID of the organisation the user belongs to + workspace_id: + type: string + description: ID of the workspace the resource belongs to + response_status_code: + type: integer + description: HTTP status code of the response + resource_type: + type: string + description: Type of resource that was accessed + action: + type: string + description: Action performed on the resource + client_ip: + type: string + description: IP address of the client + country: + type: string + description: Country of origin based on the IP address + total: + type: integer + description: Total number of records in the response + object: + type: string + description: The type of object being returned + enum: + - analytics-graph + UsageLimitsPolicyResponse: + allOf: + - $ref: '#/components/schemas/UsageLimitsPolicy' + - type: object + properties: + object: + type: string + example: policy_usage_limits + IntegrationModel: + type: object + properties: + slug: + type: string + description: Model slug identifier + name: + type: string + description: Human-readable model name + enabled: + type: boolean + description: Whether the model is enabled + is_custom: + type: boolean + nullable: true + description: Whether this is a custom model + is_finetune: + type: boolean + nullable: true + description: Whether this is a fine-tuned model + base_model_slug: + type: string + nullable: true + description: Base model slug for fine-tuned models + pricing_config: + $ref: '#/components/schemas/PricingConfig' + CompletionUsage: + type: object + description: Usage statistics for the completion request. + properties: + completion_tokens: + type: integer + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + description: Number of tokens in the prompt. + total_tokens: + type: integer + description: Total number of tokens used in the request (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens + GuardrailActions: + type: object + description: Actions to take when guardrail checks fail or pass + properties: + deny: + type: boolean + description: Whether to deny the request when guardrail check fails + default: false + async: + type: boolean + description: Whether the guardrail check should be performed asynchronously + default: false + on_success: + type: object + description: Actions to take when guardrail check passes + properties: + feedback: + type: object + description: Feedback configuration for successful checks + properties: + value: + type: number + description: Feedback value for successful checks + default: 5 + weight: + type: number + description: Weight of the feedback + default: 1 + metadata: + type: string + description: Additional metadata for the feedback + default: '' + required: + - value + - weight + - metadata + required: + - feedback + on_fail: + type: object + description: Actions to take when guardrail check fails + properties: + feedback: + type: object + description: Feedback configuration for failed checks + properties: + value: + type: number + description: Feedback value for failed checks + default: -5 + weight: + type: number + description: Weight of the feedback + default: 1 + metadata: + type: string + description: Additional metadata for the feedback + default: '' + required: + - value + - weight + - metadata + required: + - feedback + required: + - deny + - async + - on_success + - on_fail + CustomHostConfiguration: + type: object + properties: + custom_host: + type: string + description: Custom host URL (can be used along with other provider specific configuration fields) + custom_headers: + type: object + additionalProperties: + type: string + description: Custom headers to send with requests (can be used along with other provider specific configuration + fields) + PromptPartialVersion: + type: object + properties: + prompt_partial_id: + type: string + format: uuid + prompt_partial_version_id: + type: string + format: uuid + slug: + type: string + version: + type: string + string: + type: string + description: + type: string + created_at: + type: string + format: date-time + prompt_version_status: + type: string + enum: + - active + - archived + object: + type: string + enum: + - partial + GuardrailCheck: + type: object + required: + - id + properties: + id: + type: string + description: Identifier of the guardrail check type (e.g., "default.regexMatch", "portkey.pii", "bedrock.guard") + parameters: + type: object + additionalProperties: true + description: Configuration parameters specific to the check type + name: + type: string + description: Custom name for this specific check instance + is_enabled: + type: boolean + description: Whether this check is enabled + default: true + FunctionParameters: + type: object + description: "The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling)\ + \ for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation\ + \ about the format. \n\nOmitting `parameters` defines a function with an empty parameter list." + additionalProperties: true + UsageLimits: + type: object + properties: + credit_limit: + type: integer + description: Credit Limit. Used for tracking usage + minimum: 1 + default: null + type: + type: string + description: Type of credit limit + enum: + - cost + - tokens + alert_threshold: + type: integer + description: Alert Threshold. Used for alerting when usage reaches more than this + minimum: 1 + default: null + periodic_reset: + type: string + description: Reset the usage periodically. + enum: + - monthly + - weekly + example: + credit_limit: 10 + periodic_reset: monthly + alert_threshold: 8 + IntegrationWorkspacesResponse: + type: object + properties: + total: + type: integer + description: Total number of workspaces + workspaces: + type: array + items: + $ref: '#/components/schemas/IntegrationWorkspace' + ParallelToolCalls: + description: Whether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling) + during tool use. + type: boolean + default: true + SentenceCountParameters: + type: object + properties: + minSentences: + type: number + description: Minimum number of sentences to allow + default: 0 + maxSentences: + type: number + description: Maximum number of sentences to allow + default: 99999 + not: + type: boolean + description: If true, the verdict will be inverted + default: false + JSONKeysParameters: + type: object + required: + - keys + - operator + properties: + keys: + type: array + items: + type: string + description: Keys to check for in JSON + operator: + type: string + enum: + - any + - all + - none + description: Operator to use for key checking + default: any + FunctionObject: + type: object + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with + a maximum length of 64. + parameters: + $ref: '#/components/schemas/FunctionParameters' + strict: + type: boolean + nullable: true + default: false + description: Whether to enable strict schema adherence when generating the function call. If set to true, the model + will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when + `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). + required: + - name + RateLimitsPolicyListResponse: + type: object + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: '#/components/schemas/RateLimitsPolicy' + total: + type: integer + description: Total number of policies + RateLimitsPolicyResponse: + allOf: + - $ref: '#/components/schemas/RateLimitsPolicy' + - type: object + properties: + object: + type: string + example: policy_rate_limits + JSONSchemaParameters: + type: object + required: + - schema + properties: + schema: + type: object + additionalProperties: true + description: JSON schema to validate against + not: + type: boolean + description: If true, the verdict will be inverted + default: false + WorkspaceUpdateRequest: + type: object + required: + - id + - enabled + properties: + id: + type: string + description: Workspace ID + example: ws-my-team-1234 + enabled: + type: boolean + description: Whether to enable workspace access + usage_limits: + type: array + nullable: true + maxItems: 1 + items: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + type: array + nullable: true + maxItems: 1 + items: + $ref: '#/components/schemas/RateLimits' + reset_usage: + type: boolean + description: Whether to reset current usage. If the current status is exhausted, this will change it back to active. + ChatCompletionToolChoiceOption: + description: | + Controls which (if any) tool is called by the model. + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + + `none` is the default when no tools are present. `auto` is the default if tools are present. + oneOf: + - type: string + description: | + `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. + enum: + - none + - auto + - required + - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' + x-oaiExpandable: true + GroupBy: + type: object + required: + - key + properties: + key: + type: string + description: | + Group by key. Valid values: + - `api_key` - Group by API key + - `organisation_id` - Group by organization + - `workspace_id` - Group by workspace + - `metadata.*` - Group by custom metadata fields + example: api_key + VertexAIConfiguration: + type: object + required: + - vertex_auth_type + - vertex_region + properties: + vertex_auth_type: + type: string + enum: + - basic + - serviceAccount + description: Vertex AI authentication type + vertex_region: + type: string + description: GCP region + vertex_project_id: + type: string + description: GCP project ID (required for basic auth) + vertex_service_account_json: + type: object + description: Service account JSON (required for serviceAccount auth) + CreatePolicyResponse: + type: object + properties: + id: + type: string + format: uuid + description: Created policy UUID + object: + type: string + description: Resource type + example: policy_usage_limits + ValidUrlsParameters: + type: object + properties: + onlyDNS: + type: boolean + description: Only check if URL domains resolve (10x faster) + default: false + not: + type: boolean + description: If true, the verdict will be inverted + default: false + PricingConfig: + type: object + properties: + type: + type: string + enum: + - static + description: Pricing type + pay_as_you_go: + $ref: '#/components/schemas/PayAsYouGoPricing' + CortexConfiguration: + type: object + required: + - snowflake_account + properties: + snowflake_account: + type: string + description: Snowflake account identifier + ChatCompletionTokenLogprob: + type: object + properties: + token: &id004 + description: The token. + type: string + logprob: &id005 + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value + `-9999.0` is used to signify that the token is very unlikely. + type: number + bytes: &id006 + description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where + characters are represented by multiple tokens and their byte representations must be combined to generate the + correct text representation. Can be `null` if there is no bytes representation for the token. + type: array + items: + type: integer + nullable: true + top_logprobs: + description: List of the most likely tokens and their log probability, at this token position. In rare cases, there + may be fewer than the number of requested `top_logprobs` returned. + type: array + items: + type: object + properties: + token: *id004 + logprob: *id005 + bytes: *id006 + required: + - token + - logprob + - bytes + required: + - token + - logprob + - bytes + - top_logprobs + UsageLimitsPolicy: + type: object + required: + - id + - type + - status + - workspace_id + - organisation_id + - created_at + - last_updated_at + properties: + id: + type: string + format: uuid + description: Policy UUID + name: + type: string + nullable: true + description: Policy name + conditions: + type: array + items: + $ref: '#/components/schemas/Condition' + description: Array of conditions + group_by: + type: array + items: + $ref: '#/components/schemas/GroupBy' + description: Array of group by fields + type: + type: string + enum: + - cost + - tokens + description: Policy type + credit_limit: + type: number + description: Maximum usage allowed + alert_threshold: + type: number + nullable: true + description: Alert threshold + periodic_reset: + type: string + nullable: true + enum: + - monthly + - weekly + description: Reset period + status: + type: string + enum: + - active + - archived + description: Policy status + workspace_id: + type: string + format: uuid + description: Workspace UUID + organisation_id: + type: string + format: uuid + description: Organization UUID + created_at: + type: string + format: date-time + description: Creation timestamp + last_updated_at: + type: string + format: date-time + description: Last update timestamp + value_key_usage_map: + type: object + additionalProperties: + $ref: '#/components/schemas/ValueKeyUsage' + description: Map of value keys to usage information (only included when include_usage=true) + ChatCompletionNamedToolChoice: + type: object + description: Specifies a tool the model should use. Use to force the model to call a specific function. + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + required: + - type + - function + AporiaParameters: + type: object + required: + - projectID + properties: + projectID: + type: string + description: Aporia Project ID to validate + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + ChatCompletionRequestUserMessage: + type: object + title: User message + properties: + content: + description: | + The contents of the user message. + oneOf: + - type: string + description: The text contents of the message. + title: Text content + - type: array + description: An array of content parts with a defined type, each can be of type `text` or `image_url` when passing + in images. You can pass multiple images by adding multiple `image_url` content parts. Image input is only supported + when using the `gpt-4-visual-preview` model. + title: Array of content parts + items: + $ref: '#/components/schemas/ChatCompletionRequestMessageContentPart' + minItems: 1 + x-oaiExpandable: true + role: + type: string + enum: + - user + description: The role of the messages author, in this case `user`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants + of the same role. + required: + - content + - role + Workspace: + type: object + properties: + id: + type: string + example: ws-test-a-174eb1 + slug: + type: string + example: ws-test-a-174eb1 + name: + type: string + example: New Workspace + description: + type: string + nullable: true + example: null + created_at: + type: string + format: date-time + example: 2024-07-30 13:27:29+00:00 + last_updated_at: + type: string + format: date-time + example: 2024-07-30 13:27:29+00:00 + defaults: + type: object + nullable: true + properties: + metadata: + type: object + additionalProperties: + type: string + example: + foo: bar + is_default: + type: integer + example: 0 + object: + type: string + enum: + - workspace + usage_limits: + type: array + items: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + type: array + items: + $ref: '#/components/schemas/RateLimits' + SageMakerConfiguration: + allOf: + - $ref: '#/components/schemas/BedrockConfiguration' + - type: object + properties: + amzn_sagemaker_custom_attributes: + type: string + description: Custom attributes for SageMaker + amzn_sagemaker_target_model: + type: string + description: Target model for SageMaker + amzn_sagemaker_target_variant: + type: string + description: Target variant for SageMaker + amzn_sagemaker_target_container_hostname: + type: string + description: Target container hostname + amzn_sagemaker_inference_id: + type: string + description: Inference ID + amzn_sagemaker_enable_explanations: + type: string + description: Enable explanations + amzn_sagemaker_inference_component: + type: string + description: Inference component + amzn_sagemaker_session_id: + type: string + description: Session ID + amzn_sagemaker_model_name: + type: string + description: Model name + ChatCompletionMessageContentBlock: + type: object + description: A block of content in a chat completion message. + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionMessageContentPartThinking' + - $ref: '#/components/schemas/ChatCompletionMessageContentPartRedactedThinking' + RateLimitsPolicy: + type: object + required: + - id + - type + - unit + - value + - status + - workspace_id + - organisation_id + - created_at + - last_updated_at + properties: + id: + type: string + format: uuid + description: Policy UUID + name: + type: string + nullable: true + description: Policy name + conditions: + type: array + items: + $ref: '#/components/schemas/Condition' + description: Array of conditions + group_by: + type: array + items: + $ref: '#/components/schemas/GroupBy' + description: Array of group by fields + type: + type: string + enum: + - requests + - tokens + description: Policy type + unit: + type: string + enum: + - rpm + - rph + - rpd + description: Rate unit + value: + type: number + description: Rate limit value + status: + type: string + enum: + - active + - archived + description: Policy status + workspace_id: + type: string + format: uuid + description: Workspace UUID + organisation_id: + type: string + format: uuid + description: Organization UUID + created_at: + type: string + format: date-time + description: Creation timestamp + last_updated_at: + type: string + format: date-time + description: Last update timestamp + PillarScanParameters: + type: object + required: + - scanners + properties: + scanners: + type: array + items: + type: string + enum: + - prompt_injection + - pii + - secrets + - toxic_language + - invisible_characters + description: Scanners to use for content analysis + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + ChatCompletionRequestFunctionMessage: + type: object + title: Function message + deprecated: true + properties: + role: + type: string + enum: + - function + description: The role of the messages author, in this case `function`. + content: + nullable: true + type: string + description: The contents of the function message. + name: + type: string + description: The name of the function to call. + required: + - role + - content + - name + ChatCompletionRequestMessageContentPartImage: + type: object + title: Image content part + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + image_url: + type: object + properties: + url: + type: string + description: Either a URL of the image or the base64 encoded image data. + format: uri + detail: + type: string + description: Specifies the detail level of the image. Learn more in the [Vision guide](https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding). + enum: + - auto + - low + - high + default: auto + required: + - url + required: + - type + - image_url + ChatCompletionMessageToolCall: + type: object + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + description: The function that the model called. + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the + model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. + Validate the arguments in your code before calling your function. + required: + - name + - arguments + required: + - id + - type + - function + ContainsParameters: + type: object + required: + - words + - operator + properties: + words: + type: array + items: + type: string + description: Words or phrases to check for + operator: + type: string + enum: + - any + - all + - none + description: Operator to use for word checking + default: any + PortkeyPIIParameters: + type: object + required: + - categories + properties: + redact: + type: boolean + description: Whether to redact detected PII + default: false + categories: + type: array + items: + type: string + enum: + - EMAIL_ADDRESS + - PHONE_NUMBER + - LOCATION_ADDRESS + - NAME + - IP_ADDRESS + - CREDIT_CARD + - SSN + description: Types of PII that should NOT be allowed + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + WebhookParameters: + type: object + required: + - webhookURL + properties: + webhookURL: + type: string + format: uri + description: Webhook URL to call + headers: + type: object + additionalProperties: true + description: Headers to send with the request + timeout: + type: number + description: Timeout in milliseconds + default: 3000 + failOnError: + type: boolean + description: Fail if webhook returns non-200 status or times out + default: false + BedrockGuardParameters: + type: object + required: + - guardrailVersion + - guardrailId + properties: + guardrailVersion: + type: string + description: Version of the guardrail to use + guardrailId: + type: string + description: ID of the guardrail + redact: + type: boolean + description: Whether to redact detected PII + default: false + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + CreateGuardrailResponse: + type: object + required: + - id + - slug + - version_id + properties: + id: + type: string + description: Unique identifier of the created guardrail + slug: + type: string + description: URL-friendly slug for the guardrail + version_id: + type: string + description: Version identifier for the guardrail configuration + UserList: + type: object + properties: + total: + type: integer + example: 2 + object: + type: string + enum: + - list + data: + type: array + items: + $ref: '#/components/schemas/User' + ApiKeyObjectList: + type: object + properties: + total: + type: integer + example: 2 + object: + type: string + enum: + - list + data: + type: array + items: + $ref: '#/components/schemas/ApiKeyObject' + PayAsYouGoPricing: + type: object + properties: + request_token: + $ref: '#/components/schemas/TokenPricing' + response_token: + $ref: '#/components/schemas/TokenPricing' + TokenPricing: + type: object + properties: + price: + type: number + format: float + description: Price per token + UpdateUsageLimitsPolicyRequest: + type: object + properties: + name: + type: string + maxLength: 255 + description: Policy name + credit_limit: + type: number + minimum: 0 + description: Maximum usage allowed + alert_threshold: + type: number + nullable: true + minimum: 0 + description: Threshold at which to send alerts. Must be less than credit_limit. + periodic_reset: + type: string + nullable: true + enum: + - monthly + - weekly + description: Reset period. Set to null to remove periodic reset. + reset_usage_for_value: + type: string + description: Reset usage for a specific value key (e.g., API key). This will reset the usage counter for that key + to 0. + GlobalWorkspaceAccess: + type: object + required: + - enabled + properties: + enabled: + type: boolean + description: Whether global workspace access is enabled. When enabled, the integration will be enabled for all workspaces + that are created in future. + usage_limits: + type: array + nullable: true + maxItems: 1 + items: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + type: array + nullable: true + maxItems: 1 + items: + $ref: '#/components/schemas/RateLimits' + PromptPartialSummary: + type: object + properties: + id: + type: string + format: uuid + slug: + type: string + name: + type: string + collection_id: + type: string + format: uuid + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + status: + type: string + enum: + - active + - archived + object: + type: string + enum: + - partial + PromptSummary: + type: object + properties: + id: + type: string + format: uuid + slug: + type: string + name: + type: string + collection_id: + type: string + format: uuid + model: + type: string + format: string + status: + type: string + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + object: + type: string + enum: + - prompt + UpdateGuardrailResponse: + type: object + required: + - id + - slug + properties: + id: + type: string + description: Unique identifier of the updated guardrail + slug: + type: string + description: URL-friendly slug for the guardrail + version_id: + type: string + description: New version identifier after update + ChatCompletionMessageContentPartThinking: + type: object + title: Thinking content part + properties: + type: + type: string + enum: + - thinking + description: The type of the content part. + thinking: + type: string + description: The thinking content. + required: + - type + - thinking + ChatCompletionRequestAssistantMessage: + type: object + title: Assistant message + properties: + content: + nullable: true + type: string + description: | + The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. + role: + type: string + enum: + - assistant + description: The role of the messages author, in this case `assistant`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants + of the same role. + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + function_call: + type: object + deprecated: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, + as generated by the model. + nullable: true + properties: + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the + model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. + Validate the arguments in your code before calling your function. + name: + type: string + description: The name of the function to call. + required: + - arguments + - name + required: + - role + ListGuardrailsResponse: + type: object + required: + - data + - total + properties: + data: + type: array + description: Array of guardrail summaries + items: + $ref: '#/components/schemas/GuardrailSummary' + total: + type: integer + description: Total number of guardrails available + minimum: 0 + UppercaseParameters: + type: object + properties: + not: + type: boolean + description: If true, the verdict will be inverted + default: false + BulkUpdateWorkspacesRequest: + type: object + properties: + workspaces: + type: array + items: + $ref: '#/components/schemas/WorkspaceUpdateRequest' + global_workspace_access: + $ref: '#/components/schemas/GlobalWorkspaceAccess' + override_existing_workspace_access: + type: boolean + description: Whether to override existing workspace access settings + ResponseFormatJsonSchemaSchema: + type: object + title: JSON schema + description: | + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + UpdateGuardrailRequest: + type: object + properties: + name: + type: string + description: Updated name of the guardrail + checks: + type: array + description: Updated array of guardrail checks + items: + $ref: '#/components/schemas/GuardrailCheck' + minItems: 1 + actions: + $ref: '#/components/schemas/GuardrailActions' + ChatCompletionRequestDeveloperMessage: + type: object + title: Developer message + description: New role by OpenAI for select models. Must be explicitly used for models that support it. When used with + incompatible models or providers, Portkey automatically converts it to a system role. + properties: + content: + description: The contents of the Developer message. + type: string + role: + type: string + enum: + - developer + description: The role of the messages author, in this case `Developer`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants + of the same role. + required: + - content + - role + InviteRole: + type: string + enum: + - admin + - member + ChatCompletionRequestToolMessage: + type: object + title: Tool message + properties: + role: + type: string + enum: + - tool + description: The role of the messages author, in this case `tool`. + content: + type: string + description: The contents of the tool message. + tool_call_id: + type: string + description: Tool call that this message is responding to. + required: + - role + - content + - tool_call_id + CreateGuardrailRequest: + type: object + required: + - name + - checks + - actions + properties: + name: + type: string + description: Name of the guardrail + example: Content Safety Check + workspace_id: + type: string + format: uuid + description: Workspace UUID (required if organisation_id not provided and not using API key) + organisation_id: + type: string + format: uuid + description: Organisation UUID (required if workspace_id not provided and not using API key) + checks: + type: array + description: Array of guardrail checks to apply + items: + $ref: '#/components/schemas/GuardrailCheck' + minItems: 1 + actions: + $ref: '#/components/schemas/GuardrailActions' + AzureOpenAIConfiguration: + type: object + required: + - azure_resource_name + - azure_deployment_config + - azure_auth_mode + properties: + azure_auth_mode: + type: string + enum: + - default + - entra + - managed + description: Authentication mode for Azure + azure_resource_name: + type: string + description: Azure OpenAI resource name + azure_deployment_config: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/AzureDeploymentConfig' + azure_entra_tenant_id: + type: string + description: Azure AD tenant ID (required for entra auth) + azure_entra_client_id: + type: string + description: Azure AD client ID (required for entra auth) + azure_entra_client_secret: + type: string + description: Azure AD client secret (required for entra auth) + azure_managed_client_id: + type: string + description: Managed identity client ID (optional for managed auth) + CreateInvite: + type: object + required: + - email + - workspaces + - role + properties: + email: + type: string + workspaces: + type: array + items: + $ref: '#/components/schemas/WorkspaceInvite' + role: + $ref: '#/components/schemas/InviteRole' + workspace_api_key_details: + type: object + properties: + scopes: + type: array + items: + type: string + required: + - scopes + example: + email: test@john.doe + role: admin + workspaces: + - id: ws-slug + role: member + WorkspaceMemberList: + type: object + properties: + total: + type: integer + example: 2 + object: + type: string + example: list + enum: + - list + data: + type: array + items: + $ref: '#/components/schemas/WorkspaceMember' + BedrockConfiguration: + type: object + required: + - aws_auth_type + - aws_region + properties: + aws_auth_type: + type: string + enum: + - accessKey + - assumedRole + description: AWS authentication type + aws_region: + type: string + description: AWS region + aws_access_key_id: + type: string + description: AWS access key ID (required for accessKey auth) + aws_secret_access_key: + type: string + description: AWS secret access key (required for accessKey auth) + aws_role_arn: + type: string + description: AWS role ARN (required for assumedRole auth) + aws_external_id: + type: string + nullable: true + description: AWS external ID (optional for assumedRole auth) + WorkspaceWithUsers: + type: object + properties: + id: + type: string + example: ws-test-a-174eb1 + slug: + type: string + example: ws-test-a-174eb1 + name: + type: string + example: New Workspace + description: + type: string + nullable: true + example: null + created_at: + type: string + format: date-time + example: 2024-07-30 13:27:29+00:00 + last_updated_at: + type: string + format: date-time + example: 2024-07-30 13:27:29+00:00 + defaults: + type: object + nullable: true + properties: + metadata: + type: object + additionalProperties: + type: string + example: + foo: bar + is_default: + type: integer + example: 0 + input_guardrails: + type: array + items: + type: string + output_guardrails: + type: array + items: + type: string + object: + type: string + enum: + - workspace + users: + type: array + items: + type: object + $ref: '#/components/schemas/WorkspaceMember' + usage_limits: + type: array + items: + $ref: '#/components/schemas/UsageLimits' + rate_limits: + type: array + items: + $ref: '#/components/schemas/RateLimits' + WorkersAIConfiguration: + type: object + required: + - workers_ai_account_id + properties: + workers_ai_account_id: + type: string + description: Cloudflare Workers AI account ID + AzurePIIParameters: + type: object + properties: + domain: + type: string + enum: + - none + - phi + description: Domain to check against + default: none + apiVersion: + type: string + description: API version for the Content Safety API + default: '2024-11-01' + modelVersion: + type: string + description: Version of the PII detection model to use + default: latest + redact: + type: boolean + description: Whether to redact detected PII + default: false + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + ContainsCodeParameters: + type: object + required: + - format + properties: + format: + type: string + enum: + - SQL + - Python + - TypeScript + - JavaScript + - Java + - C# + - C++ + - C + - Ruby + - PHP + - Swift + - Kotlin + - Go + - Rust + - Scala + - R + - Perl + - Shell + - HTML + - CSS + - XML + - JSON + - YAML + - Markdown + - Dockerfile + description: Code format to check for + not: + type: boolean + description: If true, the verdict will be inverted + default: false + ChatCompletionRequestMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' + x-oaiExpandable: true + ChatCompletionMessageToolCalls: + type: array + description: The tool calls generated by the model, such as function calls. + items: + $ref: '#/components/schemas/ChatCompletionMessageToolCall' + OpenAIConfiguration: + type: object + properties: + openai_organization: + type: string + description: OpenAI organization ID + openai_project: + type: string + description: OpenAI project ID + ChatCompletionRequestSystemMessage: + type: object + title: System message + properties: + content: + description: The contents of the system message. + type: string + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants + of the same role. + required: + - content + - role + IntegrationList: + type: object + properties: + id: + type: string + format: UUID + organisation_id: + type: string + format: UUID + ai_provider_id: + type: string + name: + type: string + status: + type: string + enum: + - active + - archived + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + nullable: true + slug: + type: string + description: + type: string + object: + type: string + enum: + - integration + SydeGuardParameters: + type: object + properties: + prompt_injection_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for prompt injection risk score (0-1) + default: 0.5 + toxicity_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for toxicity risk score (0-1) + default: 0.5 + evasion_threshold: + type: number + minimum: 0 + maximum: 1 + multipleOf: 0.01 + description: Threshold for evasion risk score (0-1) + default: 0.5 + timeout: + type: number + description: Timeout in milliseconds + default: 5000 + CreateIntegrationRequest: + type: object + required: + - name + - ai_provider_id + properties: + name: + type: string + description: Human-readable name for the integration + example: Production OpenAI + slug: + type: string + pattern: ^[a-zA-Z0-9_-]+$ + description: URL-friendly identifier (auto-generated if not provided) + example: production-openai + ai_provider_id: + type: string + description: ID of the base AI provider + example: openai + key: + type: string + description: API key for the provider (if required) + example: sk-... + description: + type: string + description: Optional description of the integration + example: Production OpenAI integration for customer-facing applications + workspace_id: + type: string + description: Workspace ID (for workspace-scoped integrations) + example: ws-my-team-1234 + configurations: + type: object + description: Provider-specific configuration object + oneOf: + - $ref: '#/components/schemas/OpenAIConfiguration' + title: OpenAI + - $ref: '#/components/schemas/AzureOpenAIConfiguration' + title: Azure OpenAI + - $ref: '#/components/schemas/BedrockConfiguration' + title: AWS Bedrock + - $ref: '#/components/schemas/VertexAIConfiguration' + title: Vertex AI + - $ref: '#/components/schemas/AzureAIConfiguration' + title: Azure AI + - $ref: '#/components/schemas/WorkersAIConfiguration' + title: Workers AI + - $ref: '#/components/schemas/SageMakerConfiguration' + title: AWS Sagemaker + - $ref: '#/components/schemas/HuggingFaceConfiguration' + title: Hugginface + - $ref: '#/components/schemas/CortexConfiguration' + title: Cortex + - $ref: '#/components/schemas/CustomHostConfiguration' + title: Custom Base URL + JWTParameters: + type: object + required: + - jwksUri + - headerKey + properties: + jwksUri: + type: string + format: uri + description: JWKS URI of the JWT token + headerKey: + type: string + description: Header key to check for the JWT token + cacheMaxAge: + type: number + description: Cache max age in seconds + default: 86400 + clockTolerance: + type: number + description: Clock tolerance in seconds + default: 5 + maxTokenAge: + type: string + description: Max token age + default: 1d + algorithms: + type: array + items: + type: string + description: Algorithms to check for the JWT token + default: + - RS256 + User: + type: object + properties: + object: + type: string + enum: + - user + id: + type: string + format: uuid + first_name: + type: string + last_name: + type: string + role: + type: string + enum: + - admin + - member + - owner + email: + type: string + format: email + created_at: + type: string + format: date-time + last_updated_at: + type: string + format: date-time + workspace_ids: + type: array + items: + type: string + ChatCompletionTool: + type: object + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: '#/components/schemas/FunctionObject' + required: + - type + - function + ErrorResponse: + type: object + properties: + error: + $ref: '#/components/schemas/Error' + required: + - error + securitySchemes: + Portkey-Key: + type: apiKey + in: header + name: x-portkey-api-key + parameters: + RateLimitsPolicyId: + name: rateLimitsPolicyId + in: path + required: true + description: Rate limits policy UUID + schema: + type: string + format: uuid + PolicyUsageLimitsId: + name: policyUsageLimitsId + in: path + required: true + description: Usage limits policy UUID + schema: + type: string + format: uuid + WorkspaceIdQuery: + name: workspace_id + in: query + required: false + description: Workspace ID or slug + schema: + type: string + PageSize: + in: query + name: page_size + schema: + type: integer + minimum: 0 + description: Number of items per page + CurrentPage: + in: query + name: current_page + schema: + type: integer + minimum: 0 + description: Current page number +security: +- Portkey-Key: [] From 22552bb504904872a033dad3f48a3f3570441d76 Mon Sep 17 00:00:00 2001 From: Rohit Agarwal Date: Mon, 22 Dec 2025 14:44:19 +0530 Subject: [PATCH 2/2] fix: Remove remaining ChatCompletion and related schemas Removed 30 more unused schemas: - ChatCompletionFunctionCallOption, ChatCompletionStreamOptions - ChatCompletionFunctions, ChatCompletionRequestMessage - ChatCompletionResponseMessage, ChatCompletionToolChoiceOption - ChatCompletionTokenLogprob, ChatCompletionNamedToolChoice - ChatCompletionRequestUserMessage, ChatCompletionMessageContentBlock - ChatCompletionRequestFunctionMessage, ChatCompletionMessageToolCall - ChatCompletionRequestAssistantMessage, ChatCompletionRequestDeveloperMessage - ChatCompletionRequestToolMessage, ChatCompletionRequestSystemMessage - ChatCompletionTool, CompletionUsage - FunctionParameters, FunctionObject - ResponseFormatText, ResponseFormatJsonSchema, ResponseFormatJsonObject - And more... These are OpenAI completion API schemas not needed for Portkey Admin API. --- admin-openapi.yaml | 578 --------------------------------------------- 1 file changed, 578 deletions(-) diff --git a/admin-openapi.yaml b/admin-openapi.yaml index 80323188..1378c238 100644 --- a/admin-openapi.yaml +++ b/admin-openapi.yaml @@ -7340,20 +7340,6 @@ components: type: object description: Basic parameters with no specific requirements additionalProperties: true - ResponseFormatText: - type: object - title: Text - description: | - Default response format. Used to generate text responses. - properties: - type: - type: string - description: The type of response format being defined. Always `text`. - enum: - - text - x-stainless-const: true - required: - - type PatronusParameters: type: object properties: @@ -7901,16 +7887,6 @@ components: type: array items: $ref: '#/components/schemas/Invite' - ChatCompletionFunctionCallOption: - type: object - description: | - Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - properties: - name: - type: string - description: The name of the function to call. - required: - - name ModelWhitelistParameters: type: object required: @@ -7996,32 +7972,6 @@ components: azure_model_slug: type: string description: Azure model slug - ChatCompletionStreamOptions: - description: | - Options for streaming response. Only set this when you set `stream: true`. - type: object - nullable: true - default: null - properties: - include_usage: - type: boolean - description: | - If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value. - ChatCompletionFunctions: - type: object - deprecated: true - properties: - description: - type: string - description: A description of what the function does, used by the model to choose when and how to call the function. - name: - type: string - description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with - a maximum length of 64. - parameters: - $ref: '#/components/schemas/FunctionParameters' - required: - - name PortkeyLanguageParameters: type: object properties: @@ -8174,36 +8124,6 @@ components: nullable: true items: $ref: '#/components/schemas/RateLimits' - ChatCompletionRequestMessageContentPartText: - type: object - title: Text content part - properties: - type: - type: string - enum: - - text - description: The type of the content part. - text: - type: string - description: The text content. - required: - - type - - text - ChatCompletionMessageContentPartRedactedThinking: - type: object - title: Redacted thinking content part - properties: - type: - type: string - enum: - - redacted_thinking - description: The type of the content part. - data: - type: string - description: The redacted thinking content. - required: - - type - - data PromptfooParameters: type: object properties: @@ -8304,61 +8224,6 @@ components: type: number description: Timeout in milliseconds default: 5000 - ChatCompletionRequestMessage: - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' - - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' - - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' - - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' - - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' - - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' - x-oaiExpandable: true - ResponseFormatJsonSchema: - type: object - title: JSON schema - description: | - JSON Schema response format. Used to generate structured JSON responses. - Learn more about [Structured Outputs](/docs/guides/structured-outputs). - properties: - type: - type: string - description: The type of response format being defined. Always `json_schema`. - enum: - - json_schema - x-stainless-const: true - json_schema: - type: object - title: JSON schema - description: | - Structured Outputs configuration options, including a JSON Schema. - properties: - description: - type: string - description: | - A description of what the response format is for, used by the model to - determine how to respond in the format. - name: - type: string - description: | - The name of the response format. Must be a-z, A-Z, 0-9, or contain - underscores and dashes, with a maximum length of 64. - schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' - strict: - type: boolean - nullable: true - default: false - description: | - Whether to enable strict schema adherence when generating the output. - If set to true, the model will always follow the exact schema defined - in the `schema` field. Only a subset of JSON Schema is supported when - `strict` is `true`. To learn more, read the [Structured Outputs - guide](/docs/guides/structured-outputs). - required: - - name - required: - - type - - json_schema RateLimits: type: object properties: @@ -8744,66 +8609,6 @@ components: total: type: integer description: Total number of policies - ResponseFormatJsonObject: - type: object - title: JSON object - description: | - JSON object response format. An older method of generating JSON responses. - Using `json_schema` is recommended for models that support it. Note that the - model will not generate JSON without a system or user message instructing it - to do so. - properties: - type: - type: string - description: The type of response format being defined. Always `json_object`. - enum: - - json_object - x-stainless-const: true - required: - - type - ChatCompletionResponseMessage: - type: object - description: A chat completion message generated by the model. - properties: - content: - type: string - description: The contents of the message. - nullable: true - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCalls' - role: - type: string - enum: - - assistant - description: The role of the author of this message. - function_call: - type: object - deprecated: true - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, - as generated by the model. - properties: - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the - model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. - Validate the arguments in your code before calling your function. - name: - type: string - description: The name of the function to call. - required: - - name - - arguments - content_blocks: - nullable: true - type: array - description: The content blocks of the message. This is only present for certain providers with strict-open-ai-compliance - flag set to false - items: - type: object - $ref: '#/components/schemas/ChatCompletionMessageContentBlock' - required: - - role - - content EndsWithParameters: type: object required: @@ -9030,23 +8835,6 @@ components: description: Base model slug for fine-tuned models pricing_config: $ref: '#/components/schemas/PricingConfig' - CompletionUsage: - type: object - description: Usage statistics for the completion request. - properties: - completion_tokens: - type: integer - description: Number of tokens in the generated completion. - prompt_tokens: - type: integer - description: Number of tokens in the prompt. - total_tokens: - type: integer - description: Total number of tokens used in the request (prompt + completion). - required: - - prompt_tokens - - completion_tokens - - total_tokens GuardrailActions: type: object description: Actions to take when guardrail checks fail or pass @@ -9176,12 +8964,6 @@ components: type: boolean description: Whether this check is enabled default: true - FunctionParameters: - type: object - description: "The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling)\ - \ for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation\ - \ about the format. \n\nOmitting `parameters` defines a function with an empty parameter list." - additionalProperties: true UsageLimits: type: object properties: @@ -9260,27 +9042,6 @@ components: - none description: Operator to use for key checking default: any - FunctionObject: - type: object - properties: - description: - type: string - description: A description of what the function does, used by the model to choose when and how to call the function. - name: - type: string - description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with - a maximum length of 64. - parameters: - $ref: '#/components/schemas/FunctionParameters' - strict: - type: boolean - nullable: true - default: false - description: Whether to enable strict schema adherence when generating the function call. If set to true, the model - will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when - `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). - required: - - name RateLimitsPolicyListResponse: type: object properties: @@ -9343,25 +9104,6 @@ components: reset_usage: type: boolean description: Whether to reset current usage. If the current status is exhausted, this will change it back to active. - ChatCompletionToolChoiceOption: - description: | - Controls which (if any) tool is called by the model. - `none` means the model will not call any tool and instead generates a message. - `auto` means the model can pick between generating a message or calling one or more tools. - `required` means the model must call one or more tools. - Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. - - `none` is the default when no tools are present. `auto` is the default if tools are present. - oneOf: - - type: string - description: | - `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. - enum: - - none - - auto - - required - - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' - x-oaiExpandable: true GroupBy: type: object required: @@ -9437,43 +9179,6 @@ components: snowflake_account: type: string description: Snowflake account identifier - ChatCompletionTokenLogprob: - type: object - properties: - token: &id004 - description: The token. - type: string - logprob: &id005 - description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value - `-9999.0` is used to signify that the token is very unlikely. - type: number - bytes: &id006 - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where - characters are represented by multiple tokens and their byte representations must be combined to generate the - correct text representation. Can be `null` if there is no bytes representation for the token. - type: array - items: - type: integer - nullable: true - top_logprobs: - description: List of the most likely tokens and their log probability, at this token position. In rare cases, there - may be fewer than the number of requested `top_logprobs` returned. - type: array - items: - type: object - properties: - token: *id004 - logprob: *id005 - bytes: *id006 - required: - - token - - logprob - - bytes - required: - - token - - logprob - - bytes - - top_logprobs UsageLimitsPolicy: type: object required: @@ -9550,26 +9255,6 @@ components: additionalProperties: $ref: '#/components/schemas/ValueKeyUsage' description: Map of value keys to usage information (only included when include_usage=true) - ChatCompletionNamedToolChoice: - type: object - description: Specifies a tool the model should use. Use to force the model to call a specific function. - properties: - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - required: - - name - required: - - type - - function AporiaParameters: type: object required: @@ -9582,38 +9267,6 @@ components: type: number description: Timeout in milliseconds default: 5000 - ChatCompletionRequestUserMessage: - type: object - title: User message - properties: - content: - description: | - The contents of the user message. - oneOf: - - type: string - description: The text contents of the message. - title: Text content - - type: array - description: An array of content parts with a defined type, each can be of type `text` or `image_url` when passing - in images. You can pass multiple images by adding multiple `image_url` content parts. Image input is only supported - when using the `gpt-4-visual-preview` model. - title: Array of content parts - items: - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPart' - minItems: 1 - x-oaiExpandable: true - role: - type: string - enum: - - user - description: The role of the messages author, in this case `user`. - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants - of the same role. - required: - - content - - role Workspace: type: object properties: @@ -9695,13 +9348,6 @@ components: amzn_sagemaker_model_name: type: string description: Model name - ChatCompletionMessageContentBlock: - type: object - description: A block of content in a chat completion message. - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/ChatCompletionMessageContentPartThinking' - - $ref: '#/components/schemas/ChatCompletionMessageContentPartRedactedThinking' RateLimitsPolicy: type: object required: @@ -9791,86 +9437,6 @@ components: type: number description: Timeout in milliseconds default: 5000 - ChatCompletionRequestFunctionMessage: - type: object - title: Function message - deprecated: true - properties: - role: - type: string - enum: - - function - description: The role of the messages author, in this case `function`. - content: - nullable: true - type: string - description: The contents of the function message. - name: - type: string - description: The name of the function to call. - required: - - role - - content - - name - ChatCompletionRequestMessageContentPartImage: - type: object - title: Image content part - properties: - type: - type: string - enum: - - image_url - description: The type of the content part. - image_url: - type: object - properties: - url: - type: string - description: Either a URL of the image or the base64 encoded image data. - format: uri - detail: - type: string - description: Specifies the detail level of the image. Learn more in the [Vision guide](https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding). - enum: - - auto - - low - - high - default: auto - required: - - url - required: - - type - - image_url - ChatCompletionMessageToolCall: - type: object - properties: - id: - type: string - description: The ID of the tool call. - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - type: object - description: The function that the model called. - properties: - name: - type: string - description: The name of the function to call. - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the - model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. - Validate the arguments in your code before calling your function. - required: - - name - - arguments - required: - - id - - type - - function ContainsParameters: type: object required: @@ -10134,61 +9700,6 @@ components: version_id: type: string description: New version identifier after update - ChatCompletionMessageContentPartThinking: - type: object - title: Thinking content part - properties: - type: - type: string - enum: - - thinking - description: The type of the content part. - thinking: - type: string - description: The thinking content. - required: - - type - - thinking - ChatCompletionRequestAssistantMessage: - type: object - title: Assistant message - properties: - content: - nullable: true - type: string - description: | - The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. - role: - type: string - enum: - - assistant - description: The role of the messages author, in this case `assistant`. - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants - of the same role. - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCalls' - function_call: - type: object - deprecated: true - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, - as generated by the model. - nullable: true - properties: - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the - model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. - Validate the arguments in your code before calling your function. - name: - type: string - description: The name of the function to call. - required: - - arguments - - name - required: - - role ListGuardrailsResponse: type: object required: @@ -10223,13 +9734,6 @@ components: override_existing_workspace_access: type: boolean description: Whether to override existing workspace access settings - ResponseFormatJsonSchemaSchema: - type: object - title: JSON schema - description: | - The schema for the response format, described as a JSON Schema object. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true UpdateGuardrailRequest: type: object properties: @@ -10244,51 +9748,11 @@ components: minItems: 1 actions: $ref: '#/components/schemas/GuardrailActions' - ChatCompletionRequestDeveloperMessage: - type: object - title: Developer message - description: New role by OpenAI for select models. Must be explicitly used for models that support it. When used with - incompatible models or providers, Portkey automatically converts it to a system role. - properties: - content: - description: The contents of the Developer message. - type: string - role: - type: string - enum: - - developer - description: The role of the messages author, in this case `Developer`. - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants - of the same role. - required: - - content - - role InviteRole: type: string enum: - admin - member - ChatCompletionRequestToolMessage: - type: object - title: Tool message - properties: - role: - type: string - enum: - - tool - description: The role of the messages author, in this case `tool`. - content: - type: string - description: The contents of the tool message. - tool_call_id: - type: string - description: Tool call that this message is responding to. - required: - - role - - content - - tool_call_id CreateGuardrailRequest: type: object required: @@ -10557,16 +10021,6 @@ components: type: boolean description: If true, the verdict will be inverted default: false - ChatCompletionRequestMessageContentPart: - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' - x-oaiExpandable: true - ChatCompletionMessageToolCalls: - type: array - description: The tool calls generated by the model, such as function calls. - items: - $ref: '#/components/schemas/ChatCompletionMessageToolCall' OpenAIConfiguration: type: object properties: @@ -10576,25 +10030,6 @@ components: openai_project: type: string description: OpenAI project ID - ChatCompletionRequestSystemMessage: - type: object - title: System message - properties: - content: - description: The contents of the system message. - type: string - role: - type: string - enum: - - system - description: The role of the messages author, in this case `system`. - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants - of the same role. - required: - - content - - role IntegrationList: type: object properties: @@ -10776,19 +10211,6 @@ components: type: array items: type: string - ChatCompletionTool: - type: object - properties: - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - $ref: '#/components/schemas/FunctionObject' - required: - - type - - function ErrorResponse: type: object properties: