diff --git a/openapi.yaml b/openapi.yaml index 9ede08ed..4fa3d546 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -71,6 +71,14 @@ tags: description: Send and Update any feedback. - name: Logs description: Custom Logger to add external logs to Portkey. + - 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: Virtual-keys description: Create, List, Retrieve, Update, and Delete your Portkey Virtual keys. - name: Users @@ -10578,25 +10586,35 @@ paths: -H "Content-Type: application/json" \ -d '{"value":1}' - /virtual-keys: + /integrations: servers: *ControlPlaneServers get: - summary: List All Virtual Keys + summary: List All Integrations tags: - - Virtual-keys + - Integrations parameters: - in: query name: current_page schema: type: integer - required: true description: Current page, defaults to 0 - in: query name: page_size schema: type: integer - required: true - description: Page size, default to 50 + 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": @@ -10611,29 +10629,11 @@ paths: enum: [list] total: type: integer - description: Total number of virtual keys + description: Total number of integrations data: type: array items: - $ref: "#/components/schemas/VirtualKeys" - "401": - description: Unauthorized response - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - data: - type: object - properties: - message: - type: string - example: - success: false - data: - message: "Unauthorised Request" + $ref: "#/components/schemas/IntegrationList" x-code-samples: - lang: python label: Default @@ -10645,10 +10645,10 @@ paths: api_key="PORTKEY_API_KEY", ) - # List virtual keys - virtual_keys = portkey.virtual_keys.list() + # List integrations + integrations = portkey.integrations.list() - print(virtual_keys) + print(integrations) - lang: javascript label: Default source: | @@ -10658,12 +10658,12 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const virtualKeys=await portkey.virtualKeys.list({}) - console.log(virtualKeys); + const integrations = await portkey.integrations.list({}) + console.log(integrations); - lang: curl label: Default source: | - curl -X GET https://api.portkey.ai/v1/virtual-keys \ + curl -X GET https://api.portkey.ai/v1/integrations \ -H "x-portkey-api-key: PORTKEY_API_KEY" - lang: python label: Self-Hosted @@ -10676,10 +10676,10 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # List virtual keys - virtual_keys = portkey.virtual_keys.list() + # List integrations + integrations = portkey.integrations.list() - print(virtual_keys) + print(integrations) - lang: javascript label: Self-Hosted source: | @@ -10687,166 +10687,27 @@ paths: const portkey = new Portkey({ apiKey: "PORTKEY_API_KEY", - virtualKey: "PROVIDER_VIRTUAL_KEY", baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const virtualKeys=await portkey.virtualKeys.list({}) - console.log(virtualKeys); + const integrations = await portkey.integrations.list({}) + console.log(integrations); - lang: curl label: Self-Hosted source: | - curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys \ - -H "x-portkey-api-key: PORTKEY_API_KEY" \ - -H "x-portkey-virtual-key: PROVIDER_VIRTUAL_KEY" + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/integrations \ + -H "x-portkey-api-key: PORTKEY_API_KEY" post: - summary: Create a Virtual Key + summary: Create a Integration tags: - - Virtual-keys + - Integrations requestBody: required: true content: application/json: schema: - type: object - properties: - name: - type: string - provider: - type: string - enum: - - openai - - azure-openai - - ai21 - - anthropic - - anyscale - - azure-openai - - bedrock - - cohere - - deepinfra - - fireworks-ai - - google - - groq - - hugging-face - - jina - - lingyi - - mistral-ai - - monsterapi - - moonshot - - nomic - - novita-ai - - open-ai - - openrouter - - palm - - perplexity-ai - - predibase - - reka-ai - - segmind - - stability-ai - - together-ai - - vertex-ai - - workers-ai - - zhipu - key: - type: string - note: - type: string - nullable: true - apiVersion: - type: string - nullable: true - resourceName: - type: string - nullable: true - deploymentName: - type: string - nullable: true - workspace_id: - type: string - format: uuid - description: optional, needed when using organisation admin API keys - deploymentConfig: - type: array - items: - type: object - properties: - apiVersion: - type: string - alias: - type: string - is_default: - type: boolean - deploymentName: - type: string - required: ["apiVersion", "deploymentName"] - usage_limits: - $ref: "#/components/schemas/UsageLimits" - rate_limits: - $ref: "#/components/schemas/RateLimits" - expires_at: - type: string - format: date-time - examples: - generic: - value: - name: "My first virtual key" - provider: "openai" - key: "sk-jhkfkjs8d9f7jksfghkjhfg" - note: "Virtual key description" - usage_limits: - { - "credit_limit": 10, - "periodic_reset": "monthly", - "alert_threshold": 9, - } - workspace_id: "" - azure-openai: - value: - provider: "azure-openai" - key: "openai-test" - name: "Key 1 Azure Open AI" - note: "description" - deploymentConfig: - [ - { - "apiVersion": "a", - "alias": "b", - "deploymentName": "c", - is_default: true, - }, - { - "apiVersion": "a", - "alias": "b", - "deploymentName": "c", - is_default: false, - }, - ] - resourceName: "c" - bedrock: - value: - provider: "bedrock" - key: "openai-test" - name: "Bedrock Key" - note: "description" - awsAccessKeyId: "a" - awsSecretAccessKey: "b" - awsRegion: "c" - vertex-ai: - value: - provider: "vertex-ai" - key: "vertex test" - name: "Vertex AI Key" - note: "description" - vertexProjectId: "a" - vertexRegion: "b" - workers-ai: - value: - provider: "vertex-ai" - key: "cloudflare test" - name: "CF Workers AI Key" - note: "description" - workersAiAccountId: "a" + $ref: '#/components/schemas/CreateIntegrationRequest' responses: "200": description: Successful response @@ -10855,31 +10716,11 @@ paths: schema: type: object properties: - success: - type: boolean - data: - type: object - properties: - slug: - type: string - "401": - description: Unauthorized response - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - data: - type: object - properties: - message: - type: string - example: - success: false - data: - message: "Unauthorised Request" + id: + type: string + format: UUID + slug: + type: string x-code-samples: - lang: python label: Default @@ -10891,14 +10732,14 @@ paths: api_key="PORTKEY_API_KEY", ) - # Add a new virtual key - new_virtual_key = portkey.virtual_keys.create( - name="openaiVKey", - provider="openai", - key="PROVIDER_API_KEY" + # Add a new integration + integration = portkey.integrations.create( + name="openai-production", + ai_provider_id="openai", + key="sk-..." ) - print(new_virtual_key) + print(integration) - lang: javascript label: Default source: | @@ -10908,22 +10749,22 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const newVkey=await portkey.virtualKeys.create({ - name:"openaiVKey", - provider:"openai", - key:"PROVIDER_API_KEY", + const integration = await portkey.integrations.create({ + name:"openai-production", + aiProviderId:"openai", + key:"sk-...", }) - console.log(newVkey); + console.log(integration); - lang: curl label: Default source: | - curl -X POST https://api.portkey.ai/v1/virtual-keys \ + curl -X POST https://api.portkey.ai/v1/integrations \ -H "x-portkey-api-key: PORTKEY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ - "name": "openaiVKey", - "provider": "openai", - "key": "PROVIDER_API_KEY" + "name": "openai-production", + "ai_provider_id": "openai", + "key": "sk-..." }' - lang: python label: Self-Hosted @@ -10936,14 +10777,14 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Add a new virtual key - new_virtual_key = portkey.virtual_keys.create( - name="openaiVKey", - provider="openai", - key="PROVIDER_API_KEY" + # Add a new integration + integration = portkey.integrations.create( + name="openai-production", + ai_provider_id="openai", + key="sk-..." ) - print(new_virtual_key) + print(integration) - lang: javascript label: Self-Hosted source: | @@ -10954,30 +10795,30 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const newVkey=await portkey.virtualKeys.create({ - name:"openaiVKey", - provider:"openai", - key:"PROVIDER_API_KEY", + const integration = await portkey.integrations.create({ + name: "openai-production", + aiProviderId: "openai", + key: "sk-...", }) - console.log(newVkey); + console.log(integration); - lang: curl label: Self-Hosted source: | - curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys \ + curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/integrations \ -H "x-portkey-api-key: PORTKEY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ - "name": "openaiVKey", - "provider": "openai", - "key": "PROVIDER_API_KEY" + "name": "openai-production", + "ai_provider_id": "openai", + "key": "sk-..." }' - /virtual-keys/{slug}: + /integrations/{slug}: servers: *ControlPlaneServers get: - summary: Get a Virtual Key + summary: Get a Integration tags: - - Virtual-keys + - Integrations parameters: - in: path name: slug @@ -10990,25 +10831,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/VirtualKeys" - "401": - description: Unauthorized response - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - data: - type: object - properties: - message: - type: string - example: - success: false - data: - message: "Unauthorised Request" + $ref: "#/components/schemas/IntegrationDetailResponse" x-code-samples: - lang: python label: Default @@ -11082,9 +10905,9 @@ paths: console.log(vKey); put: - summary: Update a Virtual Key + summary: Update a Integration tags: - - Virtual-keys + - Integrations parameters: - in: path name: slug @@ -11096,31 +10919,7 @@ paths: content: application/json: schema: - type: object - properties: - name: - type: string - key: - type: string - note: - type: string - nullable: true - deploymentConfig: - type: array - items: - type: object - properties: - apiVersion: - type: string - alias: - type: string - is_default: - type: boolean - deploymentName: - type: string - required: ["apiVersion", "deploymentName"] - usage_limits: - $ref: "#/components/schemas/UsageLimits" + $ref: '#/components/schemas/UpdateIntegrationRequest' responses: "200": description: Successful response @@ -11128,25 +10927,6 @@ paths: application/json: schema: type: object - - "401": - description: Unauthorized response - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - data: - type: object - properties: - message: - type: string - example: - success: false - data: - message: "Unauthorised Request" x-code-samples: - lang: python label: Default @@ -11158,15 +10938,14 @@ paths: api_key="PORTKEY_API_KEY", ) - # Update a specific virtual key - updated_virtual_key = portkey.virtual_keys.update( - slug='VIRTUAL_KEY_SLUG', - name="openaiVKey", - note="hello", - rate_limits=[{"type": "requests", "unit": "rpm", "value": 696}] + # Update a specific integration + integration = portkey.integrations.update( + slug="INTEGRATION_SLUG', + name="updated-name", + note="hello" ) - print(updated_virtual_key) + print(integration) - lang: javascript label: Default source: | @@ -11176,46 +10955,31 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const updatedVKey=await portkey.virtualKeys.update({ - slug:'VIRTUAL_KEY_SLUG', - name:"openaiVKey", - note:"hello", - rate_limits: [{type: "requests", unit: "rpm", value: 696}] + const integration = await portkey.integrations.update({ + slug:"INTEGRATION_SLUG", + name:"updated-name", + note:"hello" }) - console.log(updatedVKey); + console.log(integration); - lang: curl label: Default source: | - curl -X PUT "https://api.portkey.ai/v1/virtual_keys/VIRTUAL_KEY_SLUG" \ + 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": "openaiVKey", - "note": "hello", - "rate_limits": [ - { - "type": "requests", - "unit": "rpm", - "value": 696 - } - ] + "name": "updated-name", + "note": "hello" }' - lang: curl label: Self-Hosted source: | - curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/virtual_keys/VIRTUAL_KEY_SLUG" \ + 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": "openaiVKey", - "note": "hello", - "rate_limits": [ - { - "type": "requests", - "unit": "rpm", - "value": 696 - } - ] + "name": "updated-name", + "note": "hello" }' - lang: python label: Self-Hosted @@ -11228,15 +10992,14 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Update a specific virtual key - updated_virtual_key = portkey.virtual_keys.update( - slug='VIRTUAL_KEY_SLUG', - name="openaiVKey", - note="hello", - rate_limits=[{"type": "requests", "unit": "rpm", "value": 696}] + # Update a specific integration + integration = portkey.integrations.update( + slug="INTEGRATION_SLUG', + name="updated-name", + note="hello" ) - print(updated_virtual_key) + print(integration) - lang: javascript label: Self-Hosted source: | @@ -11247,18 +11010,17 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const updatedVkey=await portkey.virtualKeys.update({ - slug:'VIRTUAL_KEY_SLUG', - name:"openaiVKey", - note:"hello", - rate_limits: [{type: "requests", unit: "rpm", value: 696}] + const integration = await portkey.integrations.update({ + slug:'INTEGRATION_SLUG', + name:"updated-name", + note:"hello" }) - console.log(updatedVkey); + console.log(integration); delete: - summary: Delete a Virtual Key + summary: Delete a Integration tags: - - Virtual-keys + - Integrations parameters: - in: path name: slug @@ -11272,25 +11034,6 @@ paths: application/json: schema: type: object - - "401": - description: Unauthorized response - content: - application/json: - schema: - type: object - properties: - success: - type: boolean - data: - type: object - properties: - message: - type: string - example: - success: false - data: - message: "Unauthorised Request" x-code-samples: - lang: python label: Default @@ -11302,9 +11045,9 @@ paths: api_key="PORTKEY_API_KEY", ) - # Delete a specific virtual key - result = portkey.virtual_keys.delete( - slug='VIRTUAL_KEY_SLUG' + # Delete a specific integration + result = portkey.integrations.delete( + slug="INTEGRATION_SLUG" ) print(result) @@ -11317,18 +11060,18 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const result=await portkey.virtualKeys.delete({ - slug:'VIRTUAL_KEY_SLUG', + 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/virtual_keys/VIRTUAL_KEY_SLUG + 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/virtual_keys/VIRTUAL_KEY_SLUG + curl -X DELETE https://SELF_HOSTED_CONTROL_PLANE_URL/integrations/INTEGRATION_SLUG - lang: python label: Self-Hosted source: | @@ -11340,9 +11083,9 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Delete a specific virtual key - result = portkey.virtual_keys.delete( - slug='VIRTUAL_KEY_SLUG' + # Delete a specific integration + result = portkey.integrations.delete( + slug="INTEAGRATION_SLUG" ) print(result) @@ -11356,271 +11099,172 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const result=await portkey.virtualKeys.delete({ - slug:'VIRTUAL_KEY_SLUG', + const result=await portkey.integrations.delete({ + slug:"INTEGRATION_SLUG", }) console.log(result); - /admin/users/invites: - servers: *ControlPlaneServers - post: - operationId: Invites_create - summary: Invite User - description: Send an invite to user for your organization - parameters: [] + /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: OK + '200': + description: List of integration models content: application/json: schema: - $ref: "#/components/schemas/SuccessInvite" + $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: - - User-invites + - Integrations > Models + parameters: + - in: path + name: slug + required: true + schema: + type: string 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", - ] - } - ) + $ref: '#/components/schemas/BulkUpdateModelsRequest' + responses: + '200': + description: Models updated successfully + content: + application/json: + schema: + type: object - print(user) - - lang: javascript - label: Default - source: | - import { Portkey } from "portkey-ai"; + 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 - const portkey = new Portkey({ - apiKey: "PORTKEY_API_KEY", - }) + /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' - 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); + 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: *ControlPlaneServers get: + summary: List All Providers tags: - - User-invites - summary: Get All Invites + - Providers parameters: - - name: pageSize - in: query + - in: query + name: current_page schema: type: integer - example: "1" - - name: currentPage - in: query + description: Current page, defaults to 0 + - in: query + name: page_size 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 + description: Page size, default to 50 + - in: query + name: workspace_id schema: type: string - enum: - - pending - - cancelled - - accepted - - expired - example: "pending" + description: Not required when using workspace API keys. Required when using organisation admin keys + responses: "200": - description: OK - headers: - Content-Type: - schema: - type: string - example: application/json + description: Successful response 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: "" + 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 @@ -11629,15 +11273,14 @@ paths: # Initialize the Portkey client portkey = Portkey( - api_key="PORTKEY_API_KEY", + api_key="PORTKEY_API_KEY" ) - # List user invites - user_invites = portkey.admin.users.invites.list( - email="user@example.com" - ) + # List providers + # Optional workspace_id + providers = portkey.providers.list(workspace_id="") - print(user_invites) + print(providers) - lang: javascript label: Default source: | @@ -11647,20 +11290,15 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.users.invites.list({ - email:"user@example.com" - }); - console.log(user); + const providers = await portkey.providers.list({ + workspaceId: "" // Optional + }) + console.log(providers); - 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" + 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: | @@ -11672,12 +11310,11 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # List user invites - user_invites = portkey.admin.users.invites.list( - email="user@example.com" - ) + # List virtual keys + # Optional workspace_id + providers = portkey.providers.list(workspace_id="") - print(user_invites) + print(providers) - lang: javascript label: Self-Hosted source: | @@ -11688,49 +11325,78 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user=await portkey.admin.users.invites.list({ - email:"user@example.com" - }); - console.log(user); + const providers = await portkey.providers.list({ + workspaceId: "" // 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" - /admin/users/invites/{inviteId}: - servers: *ControlPlaneServers - get: + post: + summary: Create a Provider tags: - - User-invites - summary: Get Invite - parameters: - - name: inviteId - in: path - schema: - type: string - required: true - description: string + - 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: OK - headers: - Content-Type: - schema: - type: string - example: application/json + description: Successful response 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: "" + type: object + properties: + id: + type: string + slug: + type: string x-code-samples: - lang: python label: Default @@ -11742,12 +11408,14 @@ paths: api_key="PORTKEY_API_KEY", ) - # Get a user invite - user = portkey.admin.users.invites.retrieve( - invite_id='INVITE_ID' + # Add a new provider + new_provider = portkey.providers.create( + name="openai provider", + integration_id="", + workspace_id="" ) - print(user) + print(new_provider) - lang: javascript label: Default source: | @@ -11757,20 +11425,23 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.users.invites.retrieve({ - inviteId: 'INVITE_ID', - }); - console.log(user); + const provider = await portkey.providers.create({ + name: "openai provider", + integrationId: "", + workspaceId: "" + }) + console.log(provider); - 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" + 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: | @@ -11782,12 +11453,14 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Get a user invite - user = portkey.admin.users.invites.retrieve( - invite_id='INVITE_ID' + # Add a new provider + new_provider = portkey.providers.create( + name="openai provider", + integration_id="", + workspace_id="" ) - print(user) + print(new_provider) - lang: javascript label: Self-Hosted source: | @@ -11798,33 +11471,49 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user=await portkey.admin.users.invites.retrieve({ - inviteId: 'INVITE_ID', - }); - console.log(user); - delete: + const newProvider = await portkey.providers.create({ + name: "openai provider", + integrationId: "", + workspaceId: "" + }) + 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: *ControlPlaneServers + get: + summary: Get a Provider tags: - - User-invites - summary: Delete Invite By ID + - Providers parameters: - - name: inviteId - in: path + - 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: OK - headers: - Content-Type: - schema: - type: string - example: application/json + description: Successful response content: application/json: schema: - type: object - example: {} + $ref: "#/components/schemas/Providers" x-code-samples: - lang: python label: Default @@ -11836,14 +11525,13 @@ paths: api_key="PORTKEY_API_KEY", ) - - - # Delete a user invite - user = portkey.admin.users.invites.delete( - invite_id="INVITE_ID" + # Get a specific provider + provider = portkey.providers.retrieve( + slug="PROVIDER_SLUG", + workspace_id="" ) - print(user) + print(provider) - lang: javascript label: Default source: | @@ -11853,21 +11541,21 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.users.invites.delete({ - inviteId:"INVITE_ID" + const provider = await portkey.providers.retrieve({ + slug:"PROVIDER_SLUG", + workspaceId: "" }) - - console.log(user); + console.log(provider); - 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" + 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 DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/invites/INVITE_ID" - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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: | @@ -11879,12 +11567,13 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Delete a user invite - user = portkey.admin.users.invites.delete( - invite_id="INVITE_ID" + # Get a specific provider + provider = portkey.providers.retrieve( + slug="PROVIDER_SLUG", + workspace_id="" ) - print(user) + print(provider) - lang: javascript label: Self-Hosted source: | @@ -11895,43 +11584,64 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user=await portkey.admin.users.invites.delete({ - inviteId:"INVITE_ID" + const provider = await portkey.providers.retrieve({ + slug: "PROVIDER_SLUG", + workspaceId: "" }) + console.log(provider); - console.log(user); - - /admin/users/invites/{inviteId}/resend: - servers: *ControlPlaneServers - post: + put: + summary: Update a Provider tags: - - User-invites - summary: Resend Invite - description: Resend an invite to user for your organization + - Providers parameters: - - name: inviteId - in: path + - 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: OK - headers: - Content-Type: - schema: - type: string - example: application/json + description: Successful response content: application/json: schema: type: object properties: - inviteLink: + id: + type: string + format: UUID + slug: type: string - format: uri - example: - inviteLink: https://app.portkey.ai/invite/some-invite-link x-code-samples: - lang: python label: Default @@ -11943,14 +11653,15 @@ paths: api_key="PORTKEY_API_KEY", ) - - - # Delete a user invite - user = portkey.admin.users.invites.resend( - invite_id="INVITE_ID" + # Update a specific provider + updated_provider = portkey.providers.update( + slug="PROVIDER_SLUG", + name="updated-name", + note="updated-note", + workspace_id="" ) - print(user) + print(updated_provider) - lang: javascript label: Default source: | @@ -11960,21 +11671,33 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.users.invites.resend({ - inviteId:"INVITE_ID" - }); - - console.log(user); + const updatedProvider = await portkey.providers.update({ + slug: "PROVIDER_SLUG", + name:"updated-name", + note: "updated-note", + workspaceId: "" + }) + console.log(updatedProvider); - 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" + 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 POST "SELF_HOSTED_CONTROL_PLANE_URL/admin/users/invites/INVITE_ID/resend" - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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: | @@ -11986,12 +11709,15 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Delete a user invite - user = portkey.admin.users.invites.resend( - invite_id="INVITE_ID" + # Update a specific provider + updated_provider = portkey.providers.update( + slug="PROVIDER_SLUG", + name="updated-name", + note="updated-note", + workspace_id="" ) - print(user) + print(updated_provider) - lang: javascript label: Self-Hosted source: | @@ -12002,75 +11728,37 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user=await portkey.admin.users.invites.resend({ - inviteId:"INVITE_ID" - }); - - console.log(user); + const updatedProvider = await portkey.providers.update({ + slug: "PROVIDER_SLUG", + name:"updated-name", + note: "updated-note", + workspaceId: "" + }) + console.log(updatedProvider); - /admin/users: - servers: - - url: https://api.portkey.ai/v1 - - url: https://SELF_HOSTED_CONTROL_PLANE_URL - get: + delete: + summary: Delete a Provider tags: - - Users - summary: Get users + - Providers parameters: - - name: x-portkey-api-key - in: header + - in: query + name: workspace_id 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 + description: optional, needed when using organisation admin keys + - in: path + name: slug schema: type: string - enum: - - admin - - member - - owner - example: "admin" - - name: email - in: query - schema: - type: string - format: email - example: "foo@bar.com" + required: true + description: Provider slug responses: "200": - description: OK - headers: - Content-Type: - schema: - type: string - example: application/json + description: Successful response 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" + type: object x-code-samples: - lang: python label: Default @@ -12082,10 +11770,13 @@ paths: api_key="PORTKEY_API_KEY", ) - # List users - users = portkey.admin.users.list() + # Delete a specific virtual key + result = portkey.providers.delete( + slug="PROVIDER_SLUG", + workspace_id="" + ) - print(users) + print(result) - lang: javascript label: Default source: | @@ -12095,19 +11786,19 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const users=await portkey.admin.users.list({}) - - console.log(users); + const result = await portkey.providers.delete({ + slug: "PROVIDER_SLUG", + workspaceId: "" + }) + console.log(result); - lang: curl label: Default source: | - curl -X GET "https://api.portkey.ai/v1/admin/users" - -H "x-portkey-api-key: PORTKEY_API_KEY" + curl -X DELETE https://api.portkey.ai/v1/providers/PROVIDER_SLUG?workspace_id= - lang: curl label: Self-Hosted source: | - curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/users" - -H "x-portkey-api-key: PORTKEY_API_KEY" + curl -X DELETE https://SELF_HOSTED_CONTROL_PLANE_URL/providers/PROVIDER_SLUG?workspace_id - lang: python label: Self-Hosted source: | @@ -12119,10 +11810,13 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # List users - users = portkey.admin.users.list() + # Delete a specific provider + result = portkey.providers.delete( + slug="PROVIDER_SLUG", + workspace_id="" + ) - print(users) + print(result) - lang: javascript label: Self-Hosted source: | @@ -12133,47 +11827,69 @@ paths: 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 + const result = await portkey.providers.delete({ + slug: "PROVIDER_SLUG", + workspaceId: "" + }) + console.log(result); + + /virtual-keys: + servers: *ControlPlaneServers get: + summary: List All Virtual Keys tags: - - Users - summary: Get user + - Virtual-keys parameters: - - name: userId - in: path + - in: query + name: current_page schema: - type: string + type: integer + required: true + description: Current page, defaults to 0 + - in: query + name: page_size + schema: + type: integer required: true + description: Page size, default to 50 + responses: "200": - description: OK - headers: - Content-Type: + description: Successful response + content: + application/json: schema: - type: string - example: application/json + type: object + properties: + object: + type: string + enum: [list] + total: + type: integer + description: Total number of virtual keys + data: + type: array + items: + $ref: "#/components/schemas/VirtualKeys" + "401": + description: Unauthorized response content: application/json: schema: - $ref: "#/components/schemas/User" + type: object + properties: + success: + type: boolean + data: + type: object + properties: + message: + type: string 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: + success: false + data: + message: "Unauthorised Request" + x-code-samples: - lang: python label: Default source: | @@ -12184,13 +11900,10 @@ paths: api_key="PORTKEY_API_KEY", ) - # Get a specific user - user = portkey.admin.users.retrieve( - user_id='USER_ID' - ) - - print(user) + # List virtual keys + virtual_keys = portkey.virtual_keys.list() + print(virtual_keys) - lang: javascript label: Default source: | @@ -12199,21 +11912,14 @@ paths: const portkey = new Portkey({ apiKey: "PORTKEY_API_KEY", }) - const user = await portkey.admin.users.retrieve({ - userId: 'USER_ID', - }); - console.log(user); + const virtualKeys=await portkey.virtualKeys.list({}) + console.log(virtualKeys); - 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" + curl -X GET https://api.portkey.ai/v1/virtual-keys \ + -H "x-portkey-api-key: PORTKEY_API_KEY" - lang: python label: Self-Hosted source: | @@ -12225,12 +11931,10 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Get a specific user - user = portkey.admin.users.retrieve( - user_id='USER_ID' - ) + # List virtual keys + virtual_keys = portkey.virtual_keys.list() - print(user) + print(virtual_keys) - lang: javascript label: Self-Hosted source: | @@ -12238,146 +11942,199 @@ paths: const portkey = new Portkey({ apiKey: "PORTKEY_API_KEY", + virtualKey: "PROVIDER_VIRTUAL_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" + const virtualKeys=await portkey.virtualKeys.list({}) + console.log(virtualKeys); - 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"; + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "x-portkey-virtual-key: PROVIDER_VIRTUAL_KEY" - 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: + post: + summary: Create a Virtual Key tags: - - Users - summary: Update user + - Virtual-keys requestBody: + required: true content: application/json: schema: type: object properties: - role: + name: + type: string + provider: type: string enum: - - admin - - member - example: - role: admin - parameters: - - name: userId - in: path - schema: - type: string - required: true + - openai + - azure-openai + - ai21 + - anthropic + - anyscale + - azure-openai + - bedrock + - cohere + - deepinfra + - fireworks-ai + - google + - groq + - hugging-face + - jina + - lingyi + - mistral-ai + - monsterapi + - moonshot + - nomic + - novita-ai + - open-ai + - openrouter + - palm + - perplexity-ai + - predibase + - reka-ai + - segmind + - stability-ai + - together-ai + - vertex-ai + - workers-ai + - zhipu + key: + type: string + note: + type: string + nullable: true + apiVersion: + type: string + nullable: true + resourceName: + type: string + nullable: true + deploymentName: + type: string + nullable: true + workspace_id: + type: string + format: uuid + description: optional, needed when using organisation admin API keys + deploymentConfig: + type: array + items: + type: object + properties: + apiVersion: + type: string + alias: + type: string + is_default: + type: boolean + deploymentName: + type: string + required: ["apiVersion", "deploymentName"] + usage_limits: + $ref: "#/components/schemas/UsageLimits" + rate_limits: + $ref: "#/components/schemas/RateLimits" + expires_at: + type: string + format: date-time + examples: + generic: + value: + name: "My first virtual key" + provider: "openai" + key: "sk-jhkfkjs8d9f7jksfghkjhfg" + note: "Virtual key description" + usage_limits: + { + "credit_limit": 10, + "periodic_reset": "monthly", + "alert_threshold": 9, + } + workspace_id: "" + azure-openai: + value: + provider: "azure-openai" + key: "openai-test" + name: "Key 1 Azure Open AI" + note: "description" + deploymentConfig: + [ + { + "apiVersion": "a", + "alias": "b", + "deploymentName": "c", + is_default: true, + }, + { + "apiVersion": "a", + "alias": "b", + "deploymentName": "c", + is_default: false, + }, + ] + resourceName: "c" + bedrock: + value: + provider: "bedrock" + key: "openai-test" + name: "Bedrock Key" + note: "description" + awsAccessKeyId: "a" + awsSecretAccessKey: "b" + awsRegion: "c" + vertex-ai: + value: + provider: "vertex-ai" + key: "vertex test" + name: "Vertex AI Key" + note: "description" + vertexProjectId: "a" + vertexRegion: "b" + workers-ai: + value: + provider: "vertex-ai" + key: "cloudflare test" + name: "CF Workers AI Key" + note: "description" + workersAiAccountId: "a" responses: "200": - description: OK - headers: - Content-Type: + description: Successful response + content: + application/json: schema: - type: string - example: application/json + type: object + properties: + success: + type: boolean + data: + type: object + properties: + slug: + type: string + "401": + description: Unauthorized response content: application/json: schema: type: object - example: {} + properties: + success: + type: boolean + data: + type: object + properties: + message: + type: string + example: + success: false + data: + message: "Unauthorised Request" x-code-samples: - lang: python label: Default @@ -12389,13 +12146,14 @@ paths: api_key="PORTKEY_API_KEY", ) - # Update a user - user = portkey.admin.users.update( - user_id='USER_ID', - role="member" + # Add a new virtual key + new_virtual_key = portkey.virtual_keys.create( + name="openaiVKey", + provider="openai", + key="PROVIDER_API_KEY" ) - print(user) + print(new_virtual_key) - lang: javascript label: Default source: | @@ -12405,24 +12163,23 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user = await portkey.admin.users.update({ - userId: 'USER_ID', - role: "member" + const newVkey=await portkey.virtualKeys.create({ + name:"openaiVKey", + provider:"openai", + key:"PROVIDER_API_KEY", }) - - console.log(user); + console.log(newVkey); - 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"}' + curl -X POST https://api.portkey.ai/v1/virtual-keys \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openaiVKey", + "provider": "openai", + "key": "PROVIDER_API_KEY" + }' - lang: python label: Self-Hosted source: | @@ -12434,13 +12191,14 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Update a user - user = portkey.admin.users.update( - user_id='USER_ID', - role="member" + # Add a new virtual key + new_virtual_key = portkey.virtual_keys.create( + name="openaiVKey", + provider="openai", + key="PROVIDER_API_KEY" ) - print(user) + print(new_virtual_key) - lang: javascript label: Self-Hosted source: | @@ -12451,63 +12209,61 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user = await portkey.admin.users.update({ - userId: 'USER_ID', - role: "member" + const newVkey=await portkey.virtualKeys.create({ + name:"openaiVKey", + provider:"openai", + key:"PROVIDER_API_KEY", }) - - console.log(user); - - /admin/workspaces/{workspaceId}/users: - servers: - - url: https://api.portkey.ai/v1 - - url: https://SELF_HOSTED_CONTROL_PLANE_URL - post: + console.log(newVkey); + - lang: curl + label: Self-Hosted + source: | + curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openaiVKey", + "provider": "openai", + "key": "PROVIDER_API_KEY" + }' + + /virtual-keys/{slug}: + servers: *ControlPlaneServers + get: + summary: Get a Virtual Key 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 + - Virtual-keys parameters: - - name: workspaceId - in: path + - in: path + name: slug + required: true schema: type: string - required: true responses: "200": - description: OK + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/VirtualKeys" + "401": + description: Unauthorized response content: application/json: schema: type: object - example: {} + properties: + success: + type: boolean + data: + type: object + properties: + message: + type: string + example: + success: false + data: + message: "Unauthorised Request" x-code-samples: - lang: python label: Default @@ -12519,18 +12275,12 @@ paths: 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" - } - ] + # Get a specific virtual key + virtual_key = portkey.virtual_keys.retrieve( + slug='VIRTUAL_KEY_SLUG' ) - print(user) + print(virtual_key) - lang: javascript label: Default source: | @@ -12540,26 +12290,20 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.workspaces.users.create({ - workspaceId: "WORKSPACE_SLUG", - users:[{ - id:"USER_ID", - role:'member' - }] + const vKey=await portkey.virtualKeys.retrieve({ + slug:'VIRTUAL_KEY_SLUG' }) - console.log(user); + console.log(vKey); - 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"}]}' + 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 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"}]}' + 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: | @@ -12571,18 +12315,12 @@ paths: 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" - } - ] + # Get a specific virtual key + virtual_key = portkey.virtual_keys.retrieve( + slug='VIRTUAL_KEY_SLUG' ) - print(user) + print(virtual_key) - lang: javascript label: Self-Hosted source: | @@ -12593,57 +12331,77 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user = await portkey.admin.workspaces.users.create({ - workspaceId: "WORKSPACE_SLUG", - users: [{ - id: "USER_ID", - role: 'member' - }] + const vKey=await portkey.virtualKeys.retrieve({ + slug:'VIRTUAL_KEY_SLUG' }) + console.log(vKey); - console.log(user); - - get: + put: + summary: Update a Virtual Key tags: - - Workspaces > Members - summary: Get workspace members + - Virtual-keys parameters: - - name: workspaceId - in: path - schema: - type: string + - in: path + name: slug 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" - + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + key: + type: string + note: + type: string + nullable: true + deploymentConfig: + type: array + items: + type: object + properties: + apiVersion: + type: string + alias: + type: string + is_default: + type: boolean + deploymentName: + type: string + required: ["apiVersion", "deploymentName"] + usage_limits: + $ref: "#/components/schemas/UsageLimits" responses: "200": - description: OK + description: Successful response content: application/json: schema: - $ref: "#/components/schemas/WorkspaceMemberList" + type: object + + "401": + description: Unauthorized response + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + data: + type: object + properties: + message: + type: string + example: + success: false + data: + message: "Unauthorised Request" x-code-samples: - lang: python label: Default @@ -12655,12 +12413,15 @@ paths: api_key="PORTKEY_API_KEY", ) - # Get user from workspace - users = portkey.admin.workspaces.users.list( - workspace_id="WORKSPACE_SLUG", + # Update a specific virtual key + updated_virtual_key = portkey.virtual_keys.update( + slug='VIRTUAL_KEY_SLUG', + name="openaiVKey", + note="hello", + rate_limits=[{"type": "requests", "unit": "rpm", "value": 696}] ) - print(users) + print(updated_virtual_key) - lang: javascript label: Default source: | @@ -12670,19 +12431,47 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.workspaces.users.list({ - workspaceId: 'WORKSPACE_SLUG', + const updatedVKey=await portkey.virtualKeys.update({ + slug:'VIRTUAL_KEY_SLUG', + name:"openaiVKey", + note:"hello", + rate_limits: [{type: "requests", unit: "rpm", value: 696}] }) - console.log(user); + console.log(updatedVKey); - lang: curl label: Default source: | - curl -X GET "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}/users" + curl -X PUT "https://api.portkey.ai/v1/virtual_keys/VIRTUAL_KEY_SLUG" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openaiVKey", + "note": "hello", + "rate_limits": [ + { + "type": "requests", + "unit": "rpm", + "value": 696 + } + ] + }' - 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" + curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/virtual_keys/VIRTUAL_KEY_SLUG" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "openaiVKey", + "note": "hello", + "rate_limits": [ + { + "type": "requests", + "unit": "rpm", + "value": 696 + } + ] + }' - lang: python label: Self-Hosted source: | @@ -12694,12 +12483,15 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Get user from workspace - users = portkey.admin.workspaces.users.list( - workspace_id="WORKSPACE_SLUG", + # Update a specific virtual key + updated_virtual_key = portkey.virtual_keys.update( + slug='VIRTUAL_KEY_SLUG', + name="openaiVKey", + note="hello", + rate_limits=[{"type": "requests", "unit": "rpm", "value": 696}] ) - print(users) + print(updated_virtual_key) - lang: javascript label: Self-Hosted source: | @@ -12710,55 +12502,50 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user=await portkey.admin.workspaces.users.list({ - workspaceId: 'WORKSPACE_SLUG', + const updatedVkey=await portkey.virtualKeys.update({ + slug:'VIRTUAL_KEY_SLUG', + name:"openaiVKey", + note:"hello", + rate_limits: [{type: "requests", unit: "rpm", value: 696}] }) - console.log(user); + console.log(updatedVkey); - /admin/workspaces/{workspaceId}/users/{userId}: - servers: *ControlPlaneServers - put: + delete: + summary: Delete a Virtual Key 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 + - Virtual-keys parameters: - - name: workspaceId - in: path - schema: - type: string + - in: path + name: slug required: true - - name: userId - in: path schema: type: string - required: true responses: "200": - description: OK - headers: - Content-Type: + description: Successful response + content: + application/json: schema: - type: string - example: application/json + type: object + + "401": + description: Unauthorized response content: application/json: schema: type: object - example: {} + properties: + success: + type: boolean + data: + type: object + properties: + message: + type: string + example: + success: false + data: + message: "Unauthorised Request" x-code-samples: - lang: python label: Default @@ -12770,14 +12557,12 @@ paths: 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' + # Delete a specific virtual key + result = portkey.virtual_keys.delete( + slug='VIRTUAL_KEY_SLUG' ) - print(updated_user) + print(result) - lang: javascript label: Default source: | @@ -12787,24 +12572,18 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.workspaces.users.update({ - workspaceId: 'WORKSPACE_SLUG', - userId:"USER_ID", - role:'member' + const result=await portkey.virtualKeys.delete({ + slug:'VIRTUAL_KEY_SLUG', }) - console.log(user); + console.log(result); - 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"}' + curl -X DELETE https://api.portkey.ai/v1/virtual_keys/VIRTUAL_KEY_SLUG - 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"}' + curl -X DELETE https://SELF_HOSTED_CONTROL_PLANE_URL/virtual_keys/VIRTUAL_KEY_SLUG - lang: python label: Self-Hosted source: | @@ -12816,14 +12595,12 @@ paths: 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' + # Delete a specific virtual key + result = portkey.virtual_keys.delete( + slug='VIRTUAL_KEY_SLUG' ) - print(updated_user) + print(result) - lang: javascript label: Self-Hosted source: | @@ -12834,41 +12611,33 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user=await portkey.admin.workspaces.users.update({ - workspaceId: 'WORKSPACE_SLUG', - userId:"USER_ID", - role:'member' + const result=await portkey.virtualKeys.delete({ + slug:'VIRTUAL_KEY_SLUG', }) - console.log(user); + console.log(result); - 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 + /admin/users/invites: + servers: *ControlPlaneServers + post: + operationId: Invites_create + summary: Invite User + description: Send an invite to user for your organization + parameters: [] responses: "200": description: OK - headers: - Content-Type: - schema: - type: string - example: application/json content: application/json: schema: - type: object - example: {} + $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 @@ -12880,14 +12649,27 @@ paths: api_key="PORTKEY_API_KEY", ) - # Delete user from workspace - result = portkey.admin.workspaces.users.delete( - workspace_id='WORKSPACE_SLUG', - user_id='USER_ID' + # 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 the result (if any) - print(result) + print(user) - lang: javascript label: Default source: | @@ -12897,41 +12679,105 @@ paths: apiKey: "PORTKEY_API_KEY", }) - user = await portkey.admin.workspaces.users.delete({ - workspaceId: 'WORKSPACE_SLUG', - userId:'USER_ID' + 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) + 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" + 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 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' + 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" ) - # Print the result (if any) - print(result) + # 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: | @@ -12942,28 +12788,66 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - user = await portkey.admin.workspaces.users.delete({ - workspaceId: 'WORKSPACE_SLUG', - userId:'USER_ID' + 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) + console.log(user); get: tags: - - Workspaces > Members - summary: Get member + - User-invites + summary: Get All Invites parameters: - - name: workspaceId - in: path + - 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 - required: true - - name: userId - in: path + enum: + - admin + - member + example: "admin" + - name: email + in: query schema: type: string - required: true + format: email + example: "foo@bar.com" + - name: status + in: query + schema: + type: string + enum: + - pending + - cancelled + - accepted + - expired + example: "pending" responses: "200": description: OK @@ -12975,19 +12859,23 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/WorkspaceMember" + $ref: "#/components/schemas/InviteList" 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" + 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 @@ -12999,13 +12887,12 @@ paths: api_key="PORTKEY_API_KEY", ) - # Get user from workspace - user = portkey.admin.workspaces.users.retrieve( - workspace_id="WORKSPACE_SLUG", - user_id="USER_ID" + # List user invites + user_invites = portkey.admin.users.invites.list( + email="user@example.com" ) - print(user) + print(user_invites) - lang: javascript label: Default source: | @@ -13015,20 +12902,19 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const user=await portkey.admin.workspaces.users.retrieve({ - workspaceId: 'WORKSPACE_SLUG', - userId:'USER_ID', - }) + 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/workspaces/{workspaceId}/users/{userId}" + 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/workspaces/{workspaceId}/users/{userId}" + 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 @@ -13041,13 +12927,12 @@ paths: 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" + # List user invites + user_invites = portkey.admin.users.invites.list( + email="user@example.com" ) - print(user) + print(user_invites) - lang: javascript label: Self-Hosted source: | @@ -13058,46 +12943,24 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const user=await portkey.admin.workspaces.users.retrieve({ - workspaceId: 'WORKSPACE_SLUG', - userId:'USER_ID', - }) + const user=await portkey.admin.users.invites.list({ + email:"user@example.com" + }); console.log(user); - /admin/workspaces: + /admin/users/invites/{inviteId}: servers: *ControlPlaneServers - post: + get: 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 - example: - name: My Workspace - description: My Description - defaults: - metadata: - environment: production - foo: bar + - User-invites + summary: Get Invite + parameters: + - name: inviteId + in: path + schema: + type: string + required: true + description: string responses: "200": description: OK @@ -13109,7 +12972,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Workspace" + $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 @@ -13121,19 +12997,12 @@ paths: 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" - } - } + # Get a user invite + user = portkey.admin.users.invites.retrieve( + invite_id='INVITE_ID' ) - print(workspace) + print(user) - lang: javascript label: Default source: | @@ -13143,49 +13012,20 @@ paths: 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); + const user=await portkey.admin.users.invites.retrieve({ + inviteId: 'INVITE_ID', + }); + console.log(user); - 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" - } - } - }' + 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 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" - } - } - }' + 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: | @@ -13197,19 +13037,12 @@ paths: 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" - } - } + # Get a user invite + user = portkey.admin.users.invites.retrieve( + invite_id='INVITE_ID' ) - print(workspace) + print(user) - lang: javascript label: Self-Hosted source: | @@ -13220,34 +13053,20 @@ paths: 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: + const user=await portkey.admin.users.invites.retrieve({ + inviteId: 'INVITE_ID', + }); + console.log(user); + delete: tags: - - Workspaces - summary: Get All Workspaces + - User-invites + summary: Delete Invite By ID parameters: - - name: page_size - in: query - schema: - type: integer - example: "1" - - name: current_page - in: query + - name: inviteId + in: path schema: - type: integer - example: "0" + type: string + required: true responses: "200": description: OK @@ -13259,23 +13078,8 @@ paths: 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 + type: object + example: {} x-code-samples: - lang: python label: Default @@ -13287,10 +13091,14 @@ paths: api_key="PORTKEY_API_KEY", ) - # List workspaces - workspaces = portkey.admin.workspaces.list() - print(workspaces) + + # Delete a user invite + user = portkey.admin.users.invites.delete( + invite_id="INVITE_ID" + ) + + print(user) - lang: javascript label: Default source: | @@ -13300,16 +13108,21 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const workspaces=await portkey.admin.workspaces.list({}) - console.log(workspaces); + const user=await portkey.admin.users.invites.delete({ + inviteId:"INVITE_ID" + }) + + console.log(user); - lang: curl label: Default source: | - curl -X GET https://api.portkey.ai/v1/admin/workspaces + 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 GET SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces + 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: | @@ -13321,10 +13134,12 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # List workspaces - workspaces = portkey.admin.workspaces.list() + # Delete a user invite + user = portkey.admin.users.invites.delete( + invite_id="INVITE_ID" + ) - print(workspaces) + print(user) - lang: javascript label: Self-Hosted source: | @@ -13335,48 +13150,21 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const workspaces=await portkey.admin.workspaces.list({}) - console.log(workspaces); + const user=await portkey.admin.users.invites.delete({ + inviteId:"INVITE_ID" + }) - /admin/workspaces/{workspaceId}: + console.log(user); + + /admin/users/invites/{inviteId}/resend: servers: *ControlPlaneServers - put: + post: 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 - example: - name: My Workspace - description: My Description - defaults: - metadata: - foo: bar + - User-invites + summary: Resend Invite + description: Resend an invite to user for your organization parameters: - - name: workspaceId + - name: inviteId in: path schema: type: string @@ -13393,7 +13181,12 @@ paths: application/json: schema: type: object - example: {} + properties: + inviteLink: + type: string + format: uri + example: + inviteLink: https://app.portkey.ai/invite/some-invite-link x-code-samples: - lang: python label: Default @@ -13405,17 +13198,14 @@ paths: 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" - } + + + # Delete a user invite + user = portkey.admin.users.invites.resend( + invite_id="INVITE_ID" ) - print(workspace) + print(user) - lang: javascript label: Default source: | @@ -13425,29 +13215,21 @@ paths: 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); + const user=await portkey.admin.users.invites.resend({ + inviteId:"INVITE_ID" + }); + + console.log(user); - 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"}}' + 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 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"}}' + 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: | @@ -13459,17 +13241,12 @@ paths: 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" - } + # Delete a user invite + user = portkey.admin.users.invites.resend( + invite_id="INVITE_ID" ) - print(workspace) + print(user) - lang: javascript label: Self-Hosted source: | @@ -13480,26 +13257,51 @@ paths: 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); + 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: - - Workspaces - summary: Get workspace + - Users + summary: Get users parameters: - - name: workspaceId - in: path + - name: x-portkey-api-key + in: header schema: type: string - required: true + 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 @@ -13511,7 +13313,19 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/WorkspaceWithUsers" + $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 @@ -13523,12 +13337,10 @@ paths: api_key="PORTKEY_API_KEY", ) - # Get workspace details - workspace = portkey.admin.workspaces.retrieve( - workspace_id='WORKSPACE_SLUG' - ) + # List users + users = portkey.admin.users.list() - print(workspace) + print(users) - lang: javascript label: Default source: | @@ -13538,20 +13350,19 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const workspace=await portkey.admin.workspaces.retrieve({ - workspaceId: 'WORKSPACE_SLUG', - }) - console.log(workspace); + const users=await portkey.admin.users.list({}) + + console.log(users); - lang: curl label: Default source: | - curl -X GET "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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/workspaces/{workspaceId}" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/users" + -H "x-portkey-api-key: PORTKEY_API_KEY" - lang: python label: Self-Hosted source: | @@ -13560,15 +13371,13 @@ paths: # Initialize the Portkey client portkey = Portkey( api_key="PORTKEY_API_KEY", - baseUrl="SELF_HOSTED_CONTROL_PLANE_URL" + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Get workspace details - workspace = portkey.admin.workspaces.retrieve( - workspace_id='WORKSPACE_SLUG' - ) + # List users + users = portkey.admin.users.list() - print(workspace) + print(users) - lang: javascript label: Self-Hosted source: | @@ -13579,17 +13388,20 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const workspace=await portkey.admin.workspaces.retrieve({ - workspaceId: 'WORKSPACE_SLUG', - }) - console.log(workspace); + const users=await portkey.admin.users.list({}) - delete: + console.log(users); + + /admin/users/{userId}: + servers: + - url: https://api.portkey.ai/v1 + - url: https://SELF_HOSTED_CONTROL_PLANE_URL + get: tags: - - Workspaces - summary: Delete a workspace + - Users + summary: Get user parameters: - - name: workspaceId + - name: userId in: path schema: type: string @@ -13597,7 +13409,26 @@ paths: responses: "200": description: OK - x-code-samples: + 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: | @@ -13608,12 +13439,13 @@ paths: api_key="PORTKEY_API_KEY", ) - # Delete workspace - result = portkey.admin.workspaces.delete( - workspace_id='WORKSPACE_SLUG' + # Get a specific user + user = portkey.admin.users.retrieve( + user_id='USER_ID' ) - print(result) + print(user) + - lang: javascript label: Default source: | @@ -13622,21 +13454,21 @@ paths: const portkey = new Portkey({ apiKey: "PORTKEY_API_KEY", }) + const user = await portkey.admin.users.retrieve({ + userId: 'USER_ID', + }); - const workspace=await portkey.admin.workspaces.delete({ - workspaceId: 'WORKSPACE_SLUG', - }) - console.log(workspace); + console.log(user); - lang: curl label: Default source: | - curl -X DELETE "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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 DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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: | @@ -13648,12 +13480,12 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Delete workspace - result = portkey.admin.workspaces.delete( - workspace_id='WORKSPACE_SLUG' + # Get a specific user + user = portkey.admin.users.retrieve( + user_id='USER_ID' ) - print(result) + print(user) - lang: javascript label: Self-Hosted source: | @@ -13663,1190 +13495,1014 @@ paths: apiKey: "PORTKEY_API_KEY", baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) + const user = await portkey.admin.users.retrieve({ + userId: 'USER_ID', + }); - const workspace=await portkey.admin.workspaces.delete({ - workspaceId: 'WORKSPACE_SLUG', - }) - console.log(workspace); + console.log(user); - /logs: - servers: *DataPlaneServers - post: - summary: Insert New logs + delete: tags: - - Logs - description: Submit one or more log entries - requestBody: - required: true - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/CustomLog" - - type: array - items: - $ref: "#/components/schemas/CustomLog" + - Users + summary: Remove a user + parameters: + - name: userId + in: path + schema: + type: string + required: true responses: "200": - description: Successful response + 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", + api_key="PORTKEY_API_KEY", ) - request = { - "url": "https://api.someprovider.com/model/generate", - "method": "POST", - "headers": {"Content-Type": "application/json"}, - "body": {"prompt": "What is AI?"}, - } - response = { - "status": 200, - "headers": {"Content-Type": "application/json"}, - "body": {"response": "AI stands for Artificial Intelligence..."}, - "response_time": 123, - } - metadata = { - "user_id": "123", - "user_name": "John Doe", - } - - result = portkey.logs.create(request=request, response=response, metadata=metadata) - - print(result) + # Delete a user + user = portkey.admin.users.delete( + user_id='USER_ID' + ) + print(user) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY" + apiKey: "PORTKEY_API_KEY", }) - async function main() { - const request = { - url: "https://api.someprovider.com/model/generate", - method: "POST", - headers: { "Content-Type": "application/json" }, - body: { prompt: "What is AI?" }, - }; - const response = { - status: 200, - headers: { "Content-Type": "application/json" }, - body: { response: "AI stands for Artificial Intelligence..." }, - response_time: 123, - }; - const metadata = { - user_id: "123", - user_name: "John Doe", - }; - const result = await portkey.logs.create({ - request: request, - response: response, - metadata: metadata, - }); - console.log(result); - } + const user=await portkey.admin.users.delete({ + userId: 'USER_ID', + }) - main(); + console.log(user); - lang: curl label: Default source: | - curl -X POST "https://api.portkey.ai/v1/logs" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "request": { - "url": "https://api.someprovider.com/model/generate", - "method": "POST", - "headers": { "Content-Type": "application/json" }, - "body": { "prompt": "What is AI?" } - }, - "response": { - "status": 200, - "headers": { "Content-Type": "application/json" }, - "body": { "response": "AI stands for Artificial Intelligence..." }, - "response_time": 123 - }, - "metadata": { - "user_id": "123", - "user_name": "John Doe" - } - }' + 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 POST "SELF_HOSTED_GATEWAY_URL/logs" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "request": { - "url": "https://api.someprovider.com/model/generate", - "method": "POST", - "headers": { "Content-Type": "application/json" }, - "body": { "prompt": "What is AI?" } - }, - "response": { - "status": 200, - "headers": { "Content-Type": "application/json" }, - "body": { "response": "AI stands for Artificial Intelligence..." }, - "response_time": 123 - }, - "metadata": { - "user_id": "123", - "user_name": "John Doe" - } - }' + 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_GATEWAY_URL" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - request = { - "url": "https://api.someprovider.com/model/generate", - "method": "POST", - "headers": {"Content-Type": "application/json"}, - "body": {"prompt": "What is AI?"}, - } - response = { - "status": 200, - "headers": {"Content-Type": "application/json"}, - "body": {"response": "AI stands for Artificial Intelligence..."}, - "response_time": 123, - } - metadata = { - "user_id": "123", - "user_name": "John Doe", - } - - result = portkey.logs.create(request=request, response=response, metadata=metadata) + # Delete a user + user = portkey.admin.users.delete( + user_id='USER_ID' + ) - print(result) + print(user) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl: "SELF_HOSTED_GATEWAY_URL" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - async function main() { - const request = { - url: "https://api.someprovider.com/model/generate", - method: "POST", - headers: { "Content-Type": "application/json" }, - body: { prompt: "What is AI?" }, - }; - const response = { - status: 200, - headers: { "Content-Type": "application/json" }, - body: { response: "AI stands for Artificial Intelligence..." }, - response_time: 123, - }; - const metadata = { - user_id: "123", - user_name: "John Doe", - }; - const result = await portkey.logs.create({ - request: request, - response: response, - metadata: metadata, - }); - console.log(result); - } - - main(); + const user=await portkey.admin.users.delete({ + userId: 'USER_ID', + }) - /logs/exports/{exportId}: - servers: *ControlPlaneServers - get: + console.log(user); + put: tags: - - Logs Export - summary: Get a specific logs export + - Users + summary: Update user + requestBody: + content: + application/json: + schema: + type: object + properties: + role: + type: string + enum: + - admin + - member + example: + role: admin parameters: - - name: exportId + - name: userId in: path - required: true schema: type: string + required: true responses: "200": - description: Successful response + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json content: application/json: schema: - $ref: "#/components/schemas/ExportItem" + 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" + api_key="PORTKEY_API_KEY", ) - res = portkey.logs.exports.retrieve( - export_id="EXPORT_ID" + # Update a user + user = portkey.admin.users.update( + user_id='USER_ID', + role="member" ) - print(res) + print(user) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY" + apiKey: "PORTKEY_API_KEY", }) - async function main() { - const res= await portkey.logs.exports.retrieve({ - exportId:"EXPORT_ID" - }); - - console.log(res); - } + const user = await portkey.admin.users.update({ + userId: 'USER_ID', + role: "member" + }) - main(); + console.log(user); - lang: curl label: Default source: | - curl -X GET "https://api.portkey.ai/v1/logs/exports/EXPORT_ID" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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 GET "SELF_HOSTED_CONTROL_PLANE_URL/logs/exports/EXPORT_ID" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - res = portkey.logs.exports.retrieve( - export_id='EXPORT_ID' + # Update a user + user = portkey.admin.users.update( + user_id='USER_ID', + role="member" ) - print(res) + print(user) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - async function main() { - const res= await portkey.logs.exports.retrieve({ - exportId:'EXPORT_ID' - });; + const user = await portkey.admin.users.update({ + userId: 'USER_ID', + role: "member" + }) - console.log(res); - } + console.log(user); - main() - put: + /admin/workspaces/{workspaceId}/users: + servers: + - url: https://api.portkey.ai/v1 + - url: https://SELF_HOSTED_CONTROL_PLANE_URL + post: tags: - - Logs Export - summary: Update a logs export - parameters: - - name: exportId - in: path - required: true - schema: - type: string + - Workspaces > Members + summary: Add workspace member requestBody: content: application/json: schema: type: object properties: - workspace_id: - type: string - filters: - $ref: "#/components/schemas/GenerationsFilterSchema" - requested_data: - $ref: "#/components/schemas/LogExportsRequestedData" - required: - - filters + 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: Successful response + description: OK content: application/json: schema: - $ref: "#/components/schemas/UpdateExportResponse" + 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" + api_key="PORTKEY_API_KEY", ) - res = portkey.logs.exports.update( - export_id="EXPORT_ID", - workspace_id="WORKSPACE_ID", - filters={ - "time_of_generation_max": "2024-07-25" - } + # Add user to workspace + user = portkey.admin.workspaces.users.create( + workspace_id="WORKSPACE_SLUG", + users=[ + { + "id": "USER_ID", + "role": "member" + } + ] ) - print(res) + print(user) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY" + apiKey: "PORTKEY_API_KEY", }) - async function main() { - const res = await portkey.logs.exports.update({ - exportId:"7ef9f738-a93a-xxx-xxx-xxxxx", - workspaceId: "ws-shared-xxx", - filters: { - "time_of_generation_max": "2024-07-25" - } - }); - - console.log(res); - } - - main(); + 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 PUT "https://api.portkey.ai/v1/logs/exports/EXPORT_ID" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{"workspace_id":"WORKSPACE_ID","filters":{"time_of_generation_max":"2024-07-25"}}' + 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 PUT "SELF_HOSTED_CONTROL_PLANE_URL/logs/exports/EXPORT_ID" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{"workspace_id":"WORKSPACE_ID","filters":{"time_of_generation_max":"2024-07-25"}}' + 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - res = portkey.logs.exports.update( - export_id='EXPORT_ID', - workspace_id='WORKSPACE_ID', - filters={ - 'time_of_generation_max': '2024-07-25' - } + # Add user to workspace + user = portkey.admin.workspaces.users.create( + workspace_id="WORKSPACE_SLUG", + users=[ + { + "id": "USER_ID", + "role": "member" + } + ] ) - print(res) + print(user) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - async function main() { - const res = await portkey.logs.exports.update({ - exportId:"7ef9f738-a93a-xxx-xxx-xxxxx", - workspaceId: "ws-shared-xxx", - filters: { - "time_of_generation_max": "2024-07-25" - } - }); - - console.log(res); - } + const user = await portkey.admin.workspaces.users.create({ + workspaceId: "WORKSPACE_SLUG", + users: [{ + id: "USER_ID", + role: 'member' + }] + }) - main(); + console.log(user); - /logs/exports: - servers: *ControlPlaneServers get: tags: - - Logs Export - summary: Get all logs exports + - Workspaces > Members + summary: Get workspace members parameters: - - name: workspace_id + - 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: Successful response + description: OK content: application/json: schema: - $ref: "#/components/schemas/ExportListResponse" + $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" + api_key="PORTKEY_API_KEY", ) - res = portkey.logs.exports.list( - workspace_id="WORKSPACE_ID" + # Get user from workspace + users = portkey.admin.workspaces.users.list( + workspace_id="WORKSPACE_SLUG", ) - print(res) + print(users) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; - - async function main() { - const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY" - }) - - const res = await portkey.logs.exports.list({ - workspaceId:"WORKSPACE_ID" - }); + import { Portkey } from "portkey-ai"; - console.log(res); - } + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + }) - main(); + 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/logs/exports?workspace_id=WORKSPACE_ID" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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/logs/exports?workspace_id=WORKSPACE_ID" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - res = portkey.logs.exports.list( - workspace_id="WORKSPACE_ID" + # Get user from workspace + users = portkey.admin.workspaces.users.list( + workspace_id="WORKSPACE_SLUG", ) - print(res) + print(users) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; - - async function main() { - const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" - }) + import { Portkey } from "portkey-ai"; - const res = await portkey.logs.exports.list({ - workspaceId:"WORKSPACE_ID" - }); + const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + }) - console.log(res); - } + const user=await portkey.admin.workspaces.users.list({ + workspaceId: 'WORKSPACE_SLUG', + }) + console.log(user); - main(); - post: + /admin/workspaces/{workspaceId}/users/{userId}: + servers: *ControlPlaneServers + put: tags: - - Logs Export - summary: Create log export + - Workspaces > Members + summary: Update workspace member requestBody: content: application/json: schema: type: object properties: - workspace_id: + role: type: string - filters: - $ref: "#/components/schemas/GenerationsFilterSchema" - requested_data: - $ref: "#/components/schemas/LogExportsRequestedData" - required: - - filters - - requested_data + 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: Successful response + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json content: application/json: schema: - $ref: "#/components/schemas/UpdateExportResponse" + 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" + api_key="PORTKEY_API_KEY", ) - res = portkey.logs.exports.create( - filters={ - 'time_of_generation_min': "2024-10-20", - 'time_of_generation_max': "2024-10-30" - }, - workspace_id="WORKSPACE_ID", - description="This is random description", - requested_data=[ - "id", - "trace_id", - "created_at", - "request", - "response", - "is_success", - "ai_org", - "ai_model", - "req_units", - "res_units", - "total_units", - "request_url", - "cost", - "cost_currency", - "response_time", - "response_status_code", - "mode", - "config", - "prompt_slug", - "metadata" - ] + # Update user in workspace + updated_user = portkey.admin.workspaces.users.update( + workspace_id='WORKSPACE_SLUG', + user_id="USER_ID", + role='member' ) - print(res) + print(updated_user) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY" + apiKey: "PORTKEY_API_KEY", }) - async function main() { - const res = await portkey.logs.exports.create({ - filters: { - time_of_generation_min: "2024-10-20", - time_of_generation_max: "2024-10-30" - }, - "workspaceId": "WORKSPACE_ID",", - "description": "This is random description", - "requestedData": [ - "id", - "trace_id", - "created_at", - "request", - "response", - "is_success", - "ai_org", - "ai_model", - "req_units", - "res_units", - "total_units", - "request_url", - "cost", - "cost_currency", - "response_time", - "response_status_code", - "mode", - "config", - "prompt_slug", - "metadata" - ] - }); - - console.log(res); - } - - main(); + 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 POST "https://api.portkey.ai/v1/logs/exports" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "workspace_id": "WORKSPACE_ID", - "filters": { - "time_of_generation_min": "2024-10-20", - "time_of_generation_max": "2024-10-30" - }, - "description": "This is random description", - "requested_data": [ - "id", - "trace_id", - "created_at", - "request", - "response", - "is_success", - "ai_org", - "ai_model", - "req_units", - "res_units", - "total_units", - "request_url", - "cost", - "cost_currency", - "response_time", - "response_status_code", - "mode", - "config", - "prompt_slug", - "metadata" - ] - }' + 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - res = portkey.logs.exports.create( - filters={ - 'time_of_generation_min': "2024-10-20", - 'time_of_generation_max': "2024-10-30" - }, - workspace_id="WORKSPACE_ID", - description="This is random description", - requested_data=[ - "id", - "trace_id", - "created_at", - "request", - "response", - "is_success", - "ai_org", - "ai_model", - "req_units", - "res_units", - "total_units", - "request_url", - "cost", - "cost_currency", - "response_time", - "response_status_code", - "mode", - "config", - "prompt_slug", - "metadata" - ] + # Update user in workspace + updated_user = portkey.admin.workspaces.users.update( + workspace_id='WORKSPACE_SLUG', + user_id="USER_ID", + role='member' ) - print(res) + print(updated_user) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - async function main() { - const res = await portkey.logs.exports.create({ - filters: { - time_of_generation_min: "2024-10-20", - time_of_generation_max: "2024-10-30" - }, - "workspaceId": "WORKSPACE_ID",", - "description": "This is random description", - "requestedData": [ - "id", - "trace_id", - "created_at", - "request", - "response", - "is_success", - "ai_org", - "ai_model", - "req_units", - "res_units", - "total_units", - "request_url", - "cost", - "cost_currency", - "response_time", - "response_status_code", - "mode", - "config", - "prompt_slug", - "metadata" - ] - }); + const user=await portkey.admin.workspaces.users.update({ + workspaceId: 'WORKSPACE_SLUG', + userId:"USER_ID", + role:'member' + }) + console.log(user); - console.log(res); - } - - main(); - - /logs/exports/{exportId}/start: - servers: *ControlPlaneServers - post: + delete: tags: - - Logs Export - summary: Start log export + - Workspaces > Members + summary: Remove workspace member parameters: - - name: exportId + - name: workspaceId in: path + schema: + type: string required: true + - name: userId + in: path schema: type: string + required: true responses: "200": - description: Successful response + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json content: application/json: schema: - $ref: "#/components/schemas/ExportTaskResponse" + 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" + api_key="PORTKEY_API_KEY", ) - res = portkey.logs.exports.start( - export_id='EXPORT_ID' + # Delete user from workspace + result = portkey.admin.workspaces.users.delete( + workspace_id='WORKSPACE_SLUG', + user_id='USER_ID' ) - print(res) + # Print the result (if any) + print(result) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY" + apiKey: "PORTKEY_API_KEY", }) - async function main() { - const res = await portkey.logs.exports.start({ - exportId:'EXPORT_ID' - }); - - console.log(res); - } + user = await portkey.admin.workspaces.users.delete({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID' + }) - main(); + console.log(user) - lang: curl label: Default source: | - curl -X POST https://api.portkey.ai/v1/logs/exports/EXPORT_ID/start + 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" - -H "Content-Type: application/json" - 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - res = portkey.logs.exports.start( - export_id='EXPORT_ID' + # Delete user from workspace + result = portkey.admin.workspaces.users.delete( + workspace_id='WORKSPACE_SLUG', + user_id='USER_ID' ) - print(res) + # Print the result (if any) + print(result) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - async function main() { - const res = await portkey.logs.exports.start({ - exportId:'EXPORT_ID' - }); - - console.log(res); - } + user = await portkey.admin.workspaces.users.delete({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID' + }) - main(); + console.log(user) - /logs/exports/{exportId}/cancel: - servers: *ControlPlaneServers - post: + get: tags: - - Logs Export - summary: Cancel log export + - Workspaces > Members + summary: Get member parameters: - - name: exportId + - name: workspaceId in: path + schema: + type: string required: true + - name: userId + in: path schema: type: string + required: true responses: "200": - description: Successful response + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json content: application/json: schema: - $ref: "#/components/schemas/ExportTaskResponse" + $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" + api_key="PORTKEY_API_KEY", ) - res = portkey.logs.exports.cancel( - export_id='EXPORT_ID' + # Get user from workspace + user = portkey.admin.workspaces.users.retrieve( + workspace_id="WORKSPACE_SLUG", + user_id="USER_ID" ) - print(res) + print(user) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", + apiKey: "PORTKEY_API_KEY", }) - async function main() { - const res = await portkey.logs.exports.cancel({ - exportId:'EXPORT_ID' - }); - - console.log(res); - } - - main(); + const user=await portkey.admin.workspaces.users.retrieve({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID', + }) + console.log(user); - lang: curl label: Default source: | - curl -X POST https://api.portkey.ai/v1/logs/exports/EXPORT_ID/cancel + 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" - -H "Content-Type: application/json" - 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - res = portkey.logs.exports.cancel( - export_id='EXPORT_ID' + # Get user from workspace + user = portkey.admin.workspaces.users.retrieve( + workspace_id="WORKSPACE_SLUG", + user_id="USER_ID" ) - print(res) + print(user) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - async function main() { - const res = await portkey.logs.exports.cancel({ - exportId:'EXPORT_ID' - }); - - console.log(res); - } - - main(); + const user=await portkey.admin.workspaces.users.retrieve({ + workspaceId: 'WORKSPACE_SLUG', + userId:'USER_ID', + }) + console.log(user); - /logs/exports/{exportId}/download: + /admin/workspaces: servers: *ControlPlaneServers - get: + post: tags: - - Logs Export - summary: Download log export - parameters: - - name: exportId - in: path - required: true - schema: - type: string + - 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 + example: + name: My Workspace + description: My Description + defaults: + metadata: + environment: production + foo: bar responses: "200": - description: Successful response + description: OK + headers: + Content-Type: + schema: + type: string + example: application/json content: application/json: schema: - $ref: "#/components/schemas/DownloadLogsResponse" + $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" + api_key="PORTKEY_API_KEY", ) - res = portkey.logs.exports.download( - export_id='EXPORT_ID' + # Add a workspace + workspace = portkey.admin.workspaces.create( + name='WORKSPACE_NAME_0909', + description="WORKSPACE_DESCRIPTION", + defaults={ + "metadata": { + "environment": "production", + "foo": "bar" + } + } ) - print(res) + print(workspace) - lang: javascript label: Default source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY" + apiKey: "PORTKEY_API_KEY", }) - async function main() { - const config=await portkey.logs.exports.download({ - exportId:'EXPORT_ID' - });; - - console.log(config); - } - - main() + 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 GET https://api.portkey.ai/v1/logs/exports/EXPORT_ID/download - -H "x-portkey-api-key: PORTKEY_API_KEY" - -H "Content-Type: application/json" + 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - res = portkey.logs.exports.download( - export_id='EXPORT_ID' + # Add a workspace + workspace = portkey.admin.workspaces.create( + name='WORKSPACE_NAME_0909', + description="WORKSPACE_DESCRIPTION", + defaults={ + "metadata": { + "environment": "production", + "foo": "bar" + } + } ) - print(res) + print(workspace) - lang: javascript label: Self-Hosted source: | - import Portkey from "portkey-ai"; + import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey:"PORTKEY_API_KEY", - baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - async function main() { - const config=await portkey.logs.exports.download({ - exportId:'EXPORT_ID' - });; + const workspace = await portkey.admin.workspaces.create({ + name: 'WORKSPACE_NAME_0909', + description: "WORKSPACE_DESCRIPTION", + defaults: { + metadata: { + environment: "production", + foo: "bar" + } + } + }) - console.log(config); - } + console.log(workspace) - main() - - /audit-logs: - servers: *ControlPlaneServers get: tags: - - Audit Logs - summary: Get Audit Logs + - Workspaces + summary: Get All Workspaces 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 + - name: page_size 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 + example: "1" - 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: *ControlPlaneServers - post: - tags: - - Api-Keys - summary: Create Api Keys - 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" + example: "0" responses: "200": description: OK @@ -14858,19 +14514,23 @@ paths: content: application/json: schema: - type: object - properties: - id: - type: string - format: uuid - example: "183f497a-2a7f-4f47-992e-26213fa863we" - key: - type: string - example: "abssofjosfjs" - object: - type: string - enum: ["api-key"] - example: "api-key" + $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 @@ -14882,31 +14542,10 @@ paths: 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" - ] - ) + # List workspaces + workspaces = portkey.admin.workspaces.list() - print(api_key) + print(workspaces) - lang: javascript label: Default source: | @@ -14916,242 +14555,176 @@ paths: 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); + const workspaces=await portkey.admin.workspaces.list({}) + console.log(workspaces); - 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" - ] - }' + curl -X GET https://api.portkey.ai/v1/admin/workspaces - 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); + curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces - lang: python label: Self-Hosted source: | - from portkey import Portkey + from portkey_ai import Portkey + # Initialize the Portkey client 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) - - /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" - ) + # List workspaces + workspaces = portkey.admin.workspaces.list() - print(api_keys) + print(workspaces) - lang: javascript - label: Default + label: Self-Hosted source: | import { Portkey } from "portkey-ai"; const portkey = new Portkey({ - apiKey: "PORTKEY_API_KEY" + apiKey: "PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const apiKey=await portkey.apiKeys.list({ - workspaceId:"WORKSPACE_SLUG" - }) + const workspaces=await portkey.admin.workspaces.list({}) + console.log(workspaces); - 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" + /admin/workspaces/{workspaceId}: + servers: *ControlPlaneServers + 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 + 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 GET "SELF_HOSTED_CONTROL_PLANE_URL/api-keys?workspace_id=WORKSPACE_SLUG" - -H "x-portkey-api-key: PORTKEY_API_KEY" + 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" ) - api_keys = portkey.api_keys.list( - workspace_id="WORKSPACE_SLUG" + # Update workspace + workspace = portkey.admin.workspaces.update( + workspace_id='WORKSPACE_ID', + name='WORKSPACE 0909', + description='This is a test description', + defaults={ + x: "y" + } ) - print(api_keys) + print(workspace) - lang: javascript label: Self-Hosted source: | @@ -15162,29 +14735,25 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const apiKey=await portkey.apiKeys.list({ - workspaceId:"WORKSPACE_SLUG" + 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); - console.log(apiKey); - - /api-keys/{id}: - servers: *ControlPlaneServers - put: + get: tags: - - Api-Keys - summary: Update Api Keys - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateApiKeyObject" + - Workspaces + summary: Get workspace parameters: - - name: id + - name: workspaceId in: path schema: type: string - format: uuid required: true responses: "200": @@ -15197,8 +14766,7 @@ paths: content: application/json: schema: - type: object - example: {} + $ref: "#/components/schemas/WorkspaceWithUsers" x-code-samples: - lang: python label: Default @@ -15210,39 +14778,12 @@ paths: 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" - ] + # Get workspace details + workspace = portkey.admin.workspaces.retrieve( + workspace_id='WORKSPACE_SLUG' ) - print(updated_api_key) + print(workspace) - lang: javascript label: Default source: | @@ -15252,193 +14793,20 @@ paths: 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" - ], - + const workspace=await portkey.admin.workspaces.retrieve({ + workspaceId: 'WORKSPACE_SLUG', }) - console.log(apiKey); + console.log(workspace); - 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" - ] - }' + 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/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" - ] - }' + 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: | @@ -15447,42 +14815,15 @@ paths: # Initialize the Portkey client portkey = Portkey( api_key="PORTKEY_API_KEY", - base_url="SELF_HOSTED_CONTROL_PLANE_URL" + baseUrl="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" - ] + # Get workspace details + workspace = portkey.admin.workspaces.retrieve( + workspace_id='WORKSPACE_SLUG' ) - print(updated_api_key) + print(workspace) - lang: javascript label: Self-Hosted source: | @@ -15493,89 +14834,24 @@ paths: 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" - ], - + const workspace=await portkey.admin.workspaces.retrieve({ + workspaceId: 'WORKSPACE_SLUG', }) - console.log(apiKey); + console.log(workspace); - get: + delete: tags: - - Api-Keys - summary: Get Api Keys + - Workspaces + summary: Delete a workspace parameters: - - name: id + - name: workspaceId 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 @@ -15587,12 +14863,12 @@ paths: api_key="PORTKEY_API_KEY", ) - # Get API keys - api_keys = portkey.api_keys.retrieve( - id="API_KEY_ID" + # Delete workspace + result = portkey.admin.workspaces.delete( + workspace_id='WORKSPACE_SLUG' ) - print(api_keys) + print(result) - lang: javascript label: Default source: | @@ -15602,20 +14878,19 @@ paths: apiKey: "PORTKEY_API_KEY", }) - const apiKey=await portkey.apiKeys.retrieve({ - id:"API_KEY_ID" + const workspace=await portkey.admin.workspaces.delete({ + workspaceId: 'WORKSPACE_SLUG', }) - - console.log(apiKey); + console.log(workspace); - lang: curl label: Default source: | - curl -X GET "https://api.portkey.ai/v1/api_keys/{id}" \ + 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 GET "SELF_HOSTED_CONTROL_PLANE_URL/api_keys/{id}" \ + curl -X DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \ -H "x-portkey-api-key: PORTKEY_API_KEY" - lang: python label: Self-Hosted @@ -15628,12 +14903,12 @@ paths: base_url="SELF_HOSTED_CONTROL_PLANE_URL" ) - # Get API keys - api_keys = portkey.api_keys.retrieve( - id="API_KEY_ID" + # Delete workspace + result = portkey.admin.workspaces.delete( + workspace_id='WORKSPACE_SLUG' ) - print(api_keys) + print(result) - lang: javascript label: Self-Hosted source: | @@ -15644,140 +14919,2120 @@ paths: baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" }) - const apiKey=await portkey.apiKeys.retrieve({ - id:"API_KEY_ID" + const workspace=await portkey.admin.workspaces.delete({ + workspaceId: 'WORKSPACE_SLUG', }) + console.log(workspace); - console.log(apiKey); - - delete: + /logs: + servers: *DataPlaneServers + post: + summary: Insert New logs tags: - - Api-Keys - summary: Remove a Api Key - parameters: - - name: id - in: path - schema: - type: string - format: uuid - required: true + - Logs + description: Submit one or more log entries + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/CustomLog" + - type: array + items: + $ref: "#/components/schemas/CustomLog" responses: "200": - description: OK - headers: - Content-Type: - schema: - type: string - example: application/json - content: - application/json: - schema: - type: object - example: {} + description: Successful response x-code-samples: - lang: python label: Default source: | from portkey_ai import Portkey - # Initialize the Portkey client portkey = Portkey( - api_key="PORTKEY_API_KEY", + api_key="PORTKEY_API_KEY", ) - # Delete the API key - result = portkey.api_keys.delete( - id="API_KEY_ID" - ) + request = { + "url": "https://api.someprovider.com/model/generate", + "method": "POST", + "headers": {"Content-Type": "application/json"}, + "body": {"prompt": "What is AI?"}, + } + response = { + "status": 200, + "headers": {"Content-Type": "application/json"}, + "body": {"response": "AI stands for Artificial Intelligence..."}, + "response_time": 123, + } + metadata = { + "user_id": "123", + "user_name": "John Doe", + } + + result = portkey.logs.create(request=request, response=response, metadata=metadata) print(result) + - lang: javascript label: Default source: | - import { Portkey } from "portkey-ai"; + import Portkey from "portkey-ai"; const portkey = new Portkey({ - apiKey: "PORTKEY_API_KEY", + apiKey:"PORTKEY_API_KEY" }) - const apiKey=await portkey.apiKeys.delete({ - id:"API_KEY_ID" - }) - console.log(apiKey); + async function main() { + const request = { + url: "https://api.someprovider.com/model/generate", + method: "POST", + headers: { "Content-Type": "application/json" }, + body: { prompt: "What is AI?" }, + }; + const response = { + status: 200, + headers: { "Content-Type": "application/json" }, + body: { response: "AI stands for Artificial Intelligence..." }, + response_time: 123, + }; + const metadata = { + user_id: "123", + user_name: "John Doe", + }; + const result = await portkey.logs.create({ + request: request, + response: response, + metadata: metadata, + }); + console.log(result); + } + + main(); - lang: curl label: Default source: | - curl -X DELETE "https://api.portkey.ai/v1/api_keys/{id}" \ - -H "x-portkey-api-key: PORTKEY_API_KEY" + curl -X POST "https://api.portkey.ai/v1/logs" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "request": { + "url": "https://api.someprovider.com/model/generate", + "method": "POST", + "headers": { "Content-Type": "application/json" }, + "body": { "prompt": "What is AI?" } + }, + "response": { + "status": 200, + "headers": { "Content-Type": "application/json" }, + "body": { "response": "AI stands for Artificial Intelligence..." }, + "response_time": 123 + }, + "metadata": { + "user_id": "123", + "user_name": "John Doe" + } + }' - 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" + curl -X POST "SELF_HOSTED_GATEWAY_URL/logs" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "request": { + "url": "https://api.someprovider.com/model/generate", + "method": "POST", + "headers": { "Content-Type": "application/json" }, + "body": { "prompt": "What is AI?" } + }, + "response": { + "status": 200, + "headers": { "Content-Type": "application/json" }, + "body": { "response": "AI stands for Artificial Intelligence..." }, + "response_time": 123 + }, + "metadata": { + "user_id": "123", + "user_name": "John Doe" + } + }' - 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" + api_key="PORTKEY_API_KEY", + base_url="SELF_HOSTED_GATEWAY_URL" ) - # Delete the API key - result = portkey.api_keys.delete( - id="API_KEY_ID" - ) + request = { + "url": "https://api.someprovider.com/model/generate", + "method": "POST", + "headers": {"Content-Type": "application/json"}, + "body": {"prompt": "What is AI?"}, + } + response = { + "status": 200, + "headers": {"Content-Type": "application/json"}, + "body": {"response": "AI stands for Artificial Intelligence..."}, + "response_time": 123, + } + metadata = { + "user_id": "123", + "user_name": "John Doe", + } + + result = portkey.logs.create(request=request, response=response, metadata=metadata) print(result) - lang: javascript label: Self-Hosted source: | - import { Portkey } from "portkey-ai"; + import Portkey from "portkey-ai"; const portkey = new Portkey({ - apiKey: "PORTKEY_API_KEY", - baseUrl: "SELF_HOSTED_CONTROL_PLANE_URL" + apiKey:"PORTKEY_API_KEY", + baseUrl: "SELF_HOSTED_GATEWAY_URL" }) - const apiKey=await portkey.apiKeys.delete({ - id:"API_KEY_ID" - }) - console.log(apiKey); + async function main() { + const request = { + url: "https://api.someprovider.com/model/generate", + method: "POST", + headers: { "Content-Type": "application/json" }, + body: { prompt: "What is AI?" }, + }; + const response = { + status: 200, + headers: { "Content-Type": "application/json" }, + body: { response: "AI stands for Artificial Intelligence..." }, + response_time: 123, + }; + const metadata = { + user_id: "123", + user_name: "John Doe", + }; + const result = await portkey.logs.create({ + request: request, + response: response, + metadata: metadata, + }); + console.log(result); + } - /analytics/graphs/requests: + main(); + + /logs/exports/{exportId}: servers: *ControlPlaneServers get: tags: - - Analytics > Graphs - summary: Get requests graph + - Logs Export + summary: Get a specific logs export parameters: - - $ref: "#/components/parameters/TimeOfGenerationMin" - - $ref: "#/components/parameters/TimeOfGenerationMax" - - $ref: "#/components/parameters/TotalUnitsMin" - - $ref: "#/components/parameters/TotalUnitsMax" - - $ref: "#/components/parameters/CostMin" - - $ref: "#/components/parameters/CostMax" - - $ref: "#/components/parameters/PromptTokenMin" - - $ref: "#/components/parameters/PromptTokenMax" - - $ref: "#/components/parameters/CompletionTokenMin" - - $ref: "#/components/parameters/CompletionTokenMax" - - $ref: "#/components/parameters/StatusCode" - - $ref: "#/components/parameters/WeightedFeedbackMin" - - $ref: "#/components/parameters/WeightedFeedbackMax" - - $ref: "#/components/parameters/VirtualKeys" - - $ref: "#/components/parameters/Configs" - - $ref: "#/components/parameters/WorkspaceSlug" - - $ref: "#/components/parameters/ApiKeyIds" - - $ref: "#/components/parameters/Metadata" - - $ref: "#/components/parameters/AiOrgModel" - - $ref: "#/components/parameters/TraceId" - - $ref: "#/components/parameters/SpanId" - - $ref: "#/components/parameters/PromptSlug" + - name: exportId + in: path + required: true + schema: + type: string responses: "200": - description: OK + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/ExportItem" + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + res = portkey.logs.exports.retrieve( + export_id="EXPORT_ID" + ) + + print(res) + - lang: javascript + label: Default + source: | + import Portkey from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY" + }) + + async function main() { + const res= await portkey.logs.exports.retrieve({ + exportId:"EXPORT_ID" + }); + + console.log(res); + } + + main(); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/logs/exports/EXPORT_ID" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/logs/exports/EXPORT_ID" \ + -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" + ) + + res = portkey.logs.exports.retrieve( + export_id='EXPORT_ID' + ) + + print(res) + - 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" + }) + + async function main() { + const res= await portkey.logs.exports.retrieve({ + exportId:'EXPORT_ID' + });; + + console.log(res); + } + + main() + put: + tags: + - Logs Export + summary: Update a logs export + parameters: + - name: exportId + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + workspace_id: + type: string + filters: + $ref: "#/components/schemas/GenerationsFilterSchema" + requested_data: + $ref: "#/components/schemas/LogExportsRequestedData" + required: + - filters + responses: + "200": + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/UpdateExportResponse" + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + res = portkey.logs.exports.update( + export_id="EXPORT_ID", + workspace_id="WORKSPACE_ID", + filters={ + "time_of_generation_max": "2024-07-25" + } + ) + + print(res) + - lang: javascript + label: Default + source: | + import Portkey from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY" + }) + + async function main() { + const res = await portkey.logs.exports.update({ + exportId:"7ef9f738-a93a-xxx-xxx-xxxxx", + workspaceId: "ws-shared-xxx", + filters: { + "time_of_generation_max": "2024-07-25" + } + }); + + console.log(res); + } + + main(); + - lang: curl + label: Default + source: | + curl -X PUT "https://api.portkey.ai/v1/logs/exports/EXPORT_ID" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"workspace_id":"WORKSPACE_ID","filters":{"time_of_generation_max":"2024-07-25"}}' + - lang: curl + label: Self-Hosted + source: | + curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/logs/exports/EXPORT_ID" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"workspace_id":"WORKSPACE_ID","filters":{"time_of_generation_max":"2024-07-25"}}' + - 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" + ) + + res = portkey.logs.exports.update( + export_id='EXPORT_ID', + workspace_id='WORKSPACE_ID', + filters={ + 'time_of_generation_max': '2024-07-25' + } + ) + + print(res) + - 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" + }) + + async function main() { + const res = await portkey.logs.exports.update({ + exportId:"7ef9f738-a93a-xxx-xxx-xxxxx", + workspaceId: "ws-shared-xxx", + filters: { + "time_of_generation_max": "2024-07-25" + } + }); + + console.log(res); + } + + main(); + + /logs/exports: + servers: *ControlPlaneServers + get: + tags: + - Logs Export + summary: Get all logs exports + parameters: + - name: workspace_id + in: query + schema: + type: string + responses: + "200": + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/ExportListResponse" + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + res = portkey.logs.exports.list( + workspace_id="WORKSPACE_ID" + ) + + print(res) + - lang: javascript + label: Default + source: | + import Portkey from "portkey-ai"; + + async function main() { + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY" + }) + + const res = await portkey.logs.exports.list({ + workspaceId:"WORKSPACE_ID" + }); + + console.log(res); + } + + main(); + - lang: curl + label: Default + source: | + curl -X GET "https://api.portkey.ai/v1/logs/exports?workspace_id=WORKSPACE_ID" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" + - lang: curl + label: Self-Hosted + source: | + curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/logs/exports?workspace_id=WORKSPACE_ID" \ + -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" + ) + + res = portkey.logs.exports.list( + workspace_id="WORKSPACE_ID" + ) + + print(res) + - lang: javascript + label: Self-Hosted + source: | + import Portkey from "portkey-ai"; + + async function main() { + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + baseUrl:"SELF_HOSTED_CONTROL_PLANE_URL" + }) + + const res = await portkey.logs.exports.list({ + workspaceId:"WORKSPACE_ID" + }); + + console.log(res); + } + + main(); + post: + tags: + - Logs Export + summary: Create log export + requestBody: + content: + application/json: + schema: + type: object + properties: + workspace_id: + type: string + filters: + $ref: "#/components/schemas/GenerationsFilterSchema" + requested_data: + $ref: "#/components/schemas/LogExportsRequestedData" + required: + - filters + - requested_data + responses: + "200": + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/UpdateExportResponse" + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + res = portkey.logs.exports.create( + filters={ + 'time_of_generation_min': "2024-10-20", + 'time_of_generation_max': "2024-10-30" + }, + workspace_id="WORKSPACE_ID", + description="This is random description", + requested_data=[ + "id", + "trace_id", + "created_at", + "request", + "response", + "is_success", + "ai_org", + "ai_model", + "req_units", + "res_units", + "total_units", + "request_url", + "cost", + "cost_currency", + "response_time", + "response_status_code", + "mode", + "config", + "prompt_slug", + "metadata" + ] + ) + + print(res) + - lang: javascript + label: Default + source: | + import Portkey from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY" + }) + + async function main() { + const res = await portkey.logs.exports.create({ + filters: { + time_of_generation_min: "2024-10-20", + time_of_generation_max: "2024-10-30" + }, + "workspaceId": "WORKSPACE_ID",", + "description": "This is random description", + "requestedData": [ + "id", + "trace_id", + "created_at", + "request", + "response", + "is_success", + "ai_org", + "ai_model", + "req_units", + "res_units", + "total_units", + "request_url", + "cost", + "cost_currency", + "response_time", + "response_status_code", + "mode", + "config", + "prompt_slug", + "metadata" + ] + }); + + console.log(res); + } + + main(); + - lang: curl + label: Default + source: | + curl -X POST "https://api.portkey.ai/v1/logs/exports" \ + -H "x-portkey-api-key: PORTKEY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "workspace_id": "WORKSPACE_ID", + "filters": { + "time_of_generation_min": "2024-10-20", + "time_of_generation_max": "2024-10-30" + }, + "description": "This is random description", + "requested_data": [ + "id", + "trace_id", + "created_at", + "request", + "response", + "is_success", + "ai_org", + "ai_model", + "req_units", + "res_units", + "total_units", + "request_url", + "cost", + "cost_currency", + "response_time", + "response_status_code", + "mode", + "config", + "prompt_slug", + "metadata" + ] + }' + - 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" + ) + + res = portkey.logs.exports.create( + filters={ + 'time_of_generation_min': "2024-10-20", + 'time_of_generation_max': "2024-10-30" + }, + workspace_id="WORKSPACE_ID", + description="This is random description", + requested_data=[ + "id", + "trace_id", + "created_at", + "request", + "response", + "is_success", + "ai_org", + "ai_model", + "req_units", + "res_units", + "total_units", + "request_url", + "cost", + "cost_currency", + "response_time", + "response_status_code", + "mode", + "config", + "prompt_slug", + "metadata" + ] + ) + + print(res) + - 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" + }) + + async function main() { + const res = await portkey.logs.exports.create({ + filters: { + time_of_generation_min: "2024-10-20", + time_of_generation_max: "2024-10-30" + }, + "workspaceId": "WORKSPACE_ID",", + "description": "This is random description", + "requestedData": [ + "id", + "trace_id", + "created_at", + "request", + "response", + "is_success", + "ai_org", + "ai_model", + "req_units", + "res_units", + "total_units", + "request_url", + "cost", + "cost_currency", + "response_time", + "response_status_code", + "mode", + "config", + "prompt_slug", + "metadata" + ] + }); + + console.log(res); + } + + main(); + + /logs/exports/{exportId}/start: + servers: *ControlPlaneServers + post: + tags: + - Logs Export + summary: Start log export + parameters: + - name: exportId + in: path + required: true + schema: + type: string + responses: + "200": + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/ExportTaskResponse" + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + res = portkey.logs.exports.start( + export_id='EXPORT_ID' + ) + + print(res) + - lang: javascript + label: Default + source: | + import Portkey from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY" + }) + + async function main() { + const res = await portkey.logs.exports.start({ + exportId:'EXPORT_ID' + }); + + console.log(res); + } + + main(); + - lang: curl + label: Default + source: | + curl -X POST https://api.portkey.ai/v1/logs/exports/EXPORT_ID/start + -H "x-portkey-api-key: PORTKEY_API_KEY" + -H "Content-Type: application/json" + - 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" + ) + + res = portkey.logs.exports.start( + export_id='EXPORT_ID' + ) + + print(res) + - 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" + }) + + async function main() { + const res = await portkey.logs.exports.start({ + exportId:'EXPORT_ID' + }); + + console.log(res); + } + + main(); + + /logs/exports/{exportId}/cancel: + servers: *ControlPlaneServers + post: + tags: + - Logs Export + summary: Cancel log export + parameters: + - name: exportId + in: path + required: true + schema: + type: string + responses: + "200": + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/ExportTaskResponse" + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + res = portkey.logs.exports.cancel( + export_id='EXPORT_ID' + ) + + print(res) + - lang: javascript + label: Default + source: | + import Portkey from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY", + }) + + async function main() { + const res = await portkey.logs.exports.cancel({ + exportId:'EXPORT_ID' + }); + + console.log(res); + } + + main(); + - lang: curl + label: Default + source: | + curl -X POST https://api.portkey.ai/v1/logs/exports/EXPORT_ID/cancel + -H "x-portkey-api-key: PORTKEY_API_KEY" + -H "Content-Type: application/json" + - 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" + ) + + res = portkey.logs.exports.cancel( + export_id='EXPORT_ID' + ) + + print(res) + - 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" + }) + + async function main() { + const res = await portkey.logs.exports.cancel({ + exportId:'EXPORT_ID' + }); + + console.log(res); + } + + main(); + + /logs/exports/{exportId}/download: + servers: *ControlPlaneServers + get: + tags: + - Logs Export + summary: Download log export + parameters: + - name: exportId + in: path + required: true + schema: + type: string + responses: + "200": + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/DownloadLogsResponse" + x-code-samples: + - lang: python + label: Default + source: | + from portkey_ai import Portkey + + portkey = Portkey( + api_key="PORTKEY_API_KEY" + ) + + res = portkey.logs.exports.download( + export_id='EXPORT_ID' + ) + + print(res) + - lang: javascript + label: Default + source: | + import Portkey from "portkey-ai"; + + const portkey = new Portkey({ + apiKey:"PORTKEY_API_KEY" + }) + + async function main() { + const config=await portkey.logs.exports.download({ + exportId:'EXPORT_ID' + });; + + console.log(config); + } + + main() + - lang: curl + label: Default + source: | + curl -X GET https://api.portkey.ai/v1/logs/exports/EXPORT_ID/download + -H "x-portkey-api-key: PORTKEY_API_KEY" + -H "Content-Type: application/json" + - 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" + ) + + res = portkey.logs.exports.download( + export_id='EXPORT_ID' + ) + + print(res) + - 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" + }) + + async function main() { + const config=await portkey.logs.exports.download({ + exportId:'EXPORT_ID' + });; + + console.log(config); + } + + main() + + /audit-logs: + servers: *ControlPlaneServers + 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: *ControlPlaneServers + post: + tags: + - Api-Keys + summary: Create Api Keys + 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: OK + headers: + Content-Type: + schema: + type: string + example: application/json + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + example: "183f497a-2a7f-4f47-992e-26213fa863we" + key: + type: string + example: "abssofjosfjs" + object: + type: string + enum: ["api-key"] + example: "api-key" + 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) + + /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: *ControlPlaneServers + put: + tags: + - Api-Keys + summary: Update Api Keys + 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 a 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); + + /analytics/graphs/requests: + servers: *ControlPlaneServers + get: + tags: + - Analytics > Graphs + summary: Get requests graph + parameters: + - $ref: "#/components/parameters/TimeOfGenerationMin" + - $ref: "#/components/parameters/TimeOfGenerationMax" + - $ref: "#/components/parameters/TotalUnitsMin" + - $ref: "#/components/parameters/TotalUnitsMax" + - $ref: "#/components/parameters/CostMin" + - $ref: "#/components/parameters/CostMax" + - $ref: "#/components/parameters/PromptTokenMin" + - $ref: "#/components/parameters/PromptTokenMax" + - $ref: "#/components/parameters/CompletionTokenMin" + - $ref: "#/components/parameters/CompletionTokenMax" + - $ref: "#/components/parameters/StatusCode" + - $ref: "#/components/parameters/WeightedFeedbackMin" + - $ref: "#/components/parameters/WeightedFeedbackMax" + - $ref: "#/components/parameters/VirtualKeys" + - $ref: "#/components/parameters/Configs" + - $ref: "#/components/parameters/WorkspaceSlug" + - $ref: "#/components/parameters/ApiKeyIds" + - $ref: "#/components/parameters/Metadata" + - $ref: "#/components/parameters/AiOrgModel" + - $ref: "#/components/parameters/TraceId" + - $ref: "#/components/parameters/SpanId" + - $ref: "#/components/parameters/PromptSlug" + responses: + "200": + description: OK headers: Content-Type: schema: @@ -27342,433 +28597,1076 @@ components: dataDescription: "`data` is a [message](https://platform.openai.com/docs/api-reference/messages/object)" - type: object properties: - event: - type: string - enum: ["thread.message.in_progress"] - data: - $ref: "#/components/schemas/MessageObject" + event: + type: string + enum: ["thread.message.in_progress"] + data: + $ref: "#/components/schemas/MessageObject" + required: + - event + - data + description: Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) moves to an `in_progress` state. + x-code-samples: + dataDescription: "`data` is a [message](https://platform.openai.com/docs/api-reference/messages/object)" + - type: object + properties: + event: + type: string + enum: ["thread.message.delta"] + data: + $ref: "#/components/schemas/MessageDeltaObject" + required: + - event + - data + description: Occurs when parts of a [Message](https://platform.openai.com/docs/api-reference/messages/object) are being streamed. + x-code-samples: + dataDescription: "`data` is a [message delta](https://platform.openai.com/docs/api-reference/assistants-streaming/message-delta-object)" + - type: object + properties: + event: + type: string + enum: ["thread.message.completed"] + data: + $ref: "#/components/schemas/MessageObject" + required: + - event + - data + description: Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is completed. + x-code-samples: + dataDescription: "`data` is a [message](https://platform.openai.com/docs/api-reference/messages/object)" + - type: object + properties: + event: + type: string + enum: ["thread.message.incomplete"] + data: + $ref: "#/components/schemas/MessageObject" + required: + - event + - data + description: Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) ends before it is completed. + x-code-samples: + dataDescription: "`data` is a [message](https://platform.openai.com/docs/api-reference/messages/object)" + + ErrorEvent: + type: object + properties: + event: + type: string + enum: ["error"] + data: + $ref: "#/components/schemas/Error" + required: + - event + - data + description: Occurs when an [error](https://platform.openai.com/docs/guides/error-codes/api-errors) occurs. This can happen due to an internal server error or a timeout. + x-code-samples: + dataDescription: "`data` is an [error](https://platform.openai.com/docs/guides/error-codes/api-errors)" + FileCitation: + type: object + title: File citation + description: | + A citation to a file. + properties: + type: + type: string + description: | + The type of the file citation. Always `file_citation`. + enum: + - file_citation + x-stainless-const: true + index: + type: integer + description: | + The index of the file in the list of files. + file_id: + type: string + description: | + The ID of the file. + required: + - type + - index + - file_id + FilePath: + type: object + title: File path + description: | + A path to a file. + properties: + type: + type: string + description: | + The type of the file path. Always `file_path`. + enum: + - file_path + x-stainless-const: true + file_id: + type: string + description: | + The ID of the file. + index: + type: integer + description: | + The index of the file in the list of files. + required: + - type + - file_id + - index + DoneEvent: + type: object + properties: + event: + type: string + enum: ["done"] + data: + type: string + enum: ["[DONE]"] + required: + - event + - data + description: Occurs when a stream ends. + x-code-samples: + dataDescription: "`data` is `[DONE]`" + + Batch: + type: object + properties: + id: + type: string + object: + type: string + enum: [batch] + description: The object type, which is always `batch`. + endpoint: + type: string + description: The Portkey API endpoint used by the batch. + + errors: + type: object + properties: + object: + type: string + description: The object type, which is always `list`. + data: + type: array + items: + type: object + properties: + code: + type: string + description: An error code identifying the error type. + message: + type: string + description: A human-readable message providing more details about the error. + param: + type: string + description: The name of the parameter that caused the error, if applicable. + nullable: true + line: + type: integer + description: The line number of the input file where the error occurred, if applicable. + nullable: true + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: The ID of the file containing the outputs of successfully executed requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch started processing. + expires_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch started finalizing. + completed_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch started cancelling. + cancelled_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + type: object + properties: + total: + type: integer + description: Total number of requests in the batch. + completed: + type: integer + description: Number of requests that have been completed successfully. + failed: + type: integer + description: Number of requests that have failed. required: - - event - - data - description: Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) moves to an `in_progress` state. - x-code-samples: - dataDescription: "`data` is a [message](https://platform.openai.com/docs/api-reference/messages/object)" - - type: object + - total + - completed + - failed + description: The request counts for different statuses within the batch. + metadata: + description: *metadata_description + type: object + x-oaiTypeLabel: map + nullable: true + required: + - id + - object + - endpoint + - input_file_id + - completion_window + - status + - created_at + + BatchRequestInput: + type: object + description: The per-line object of the batch input file + properties: + custom_id: + type: string + description: A developer-provided per-request id that will be used to match outputs to inputs. Must be unique for each request in a batch. + method: + type: string + enum: ["POST"] + description: The HTTP method to be used for the request. Currently only `POST` is supported. + url: + type: string + description: The Portkey API relative URL to be used for the request. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. + x-code-samples: + name: The request input object + example: | + {"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is 2+2?"}]}} + + BatchRequestOutput: + type: object + description: The per-line object of the batch output and error files + properties: + id: + type: string + custom_id: + type: string + description: A developer-provided per-request id that will be used to match outputs to inputs. + response: + type: object + nullable: true properties: - event: + status_code: + type: integer + description: The HTTP status code of the response + request_id: type: string - enum: ["thread.message.delta"] - data: - $ref: "#/components/schemas/MessageDeltaObject" - required: - - event - - data - description: Occurs when parts of a [Message](https://platform.openai.com/docs/api-reference/messages/object) are being streamed. - x-code-samples: - dataDescription: "`data` is a [message delta](https://platform.openai.com/docs/api-reference/assistants-streaming/message-delta-object)" - - type: object + description: An unique identifier for the provider API request. Please include this request ID when contacting your provider support. + body: + type: object + x-oaiTypeLabel: map + description: The JSON body of the response + error: + type: object + nullable: true + description: For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure. properties: - event: + code: type: string - enum: ["thread.message.completed"] - data: - $ref: "#/components/schemas/MessageObject" - required: - - event - - data - description: Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is completed. - x-code-samples: - dataDescription: "`data` is a [message](https://platform.openai.com/docs/api-reference/messages/object)" - - type: object - properties: - event: + description: A machine-readable error code. + message: type: string - enum: ["thread.message.incomplete"] - data: - $ref: "#/components/schemas/MessageObject" - required: - - event - - data - description: Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) ends before it is completed. - x-code-samples: - dataDescription: "`data` is a [message](https://platform.openai.com/docs/api-reference/messages/object)" + description: A human-readable error message. + x-code-samples: + name: The request output object + example: | + {"id": "batch_req_wnaDys", "custom_id": "request-2", "response": {"status_code": 200, "request_id": "req_c187b3", "body": {"id": "chatcmpl-9758Iw", "object": "chat.completion", "created": 1711475054, "model": "gpt-3.5-turbo", "choices": [{"index": 0, "message": {"role": "assistant", "content": "2 + 2 equals 4."}, "finish_reason": "stop"}], "usage": {"prompt_tokens": 24, "completion_tokens": 15, "total_tokens": 39}, "system_fingerprint": null}}, "error": null} - ErrorEvent: + ListBatchesResponse: type: object properties: - event: - type: string - enum: ["error"] data: - $ref: "#/components/schemas/Error" + type: array + items: + $ref: "#/components/schemas/Batch" + first_id: + type: string + example: "batch_abc123" + last_id: + type: string + example: "batch_abc456" + has_more: + type: boolean + object: + type: string + enum: [list] required: - - event + - object - data - description: Occurs when an [error](https://platform.openai.com/docs/guides/error-codes/api-errors) occurs. This can happen due to an internal server error or a timeout. - x-code-samples: - dataDescription: "`data` is an [error](https://platform.openai.com/docs/guides/error-codes/api-errors)" - FileCitation: + - has_more + + FeedbackRequest: + type: object + required: + - trace_id + - value + properties: + trace_id: + type: string + description: Unique identifier for the request trace. + value: + type: integer + description: Feedback value, an integer between -10 and 10. + minimum: -10 + maximum: 10 + weight: + type: number + format: float + description: Weight of the feedback, a float between 0 and 1. Default is 1.0. + minimum: 0 + maximum: 1 + default: 1.0 + metadata: + type: object + additionalProperties: true + description: Additional metadata for the feedback. + + FeedbackResponse: + type: object + properties: + status: + type: string + description: success or failure + message: + type: string + description: Confirmation message indicating successful feedback submission. + feedback_ids: + type: array + description: Ids of Feedbacks created returned in the same order as input + items: + type: string + + FeedbackUpdateRequest: + type: object + required: + - value + properties: + value: + type: integer + description: Feedback value, an integer between -10 and 10. + minimum: -10 + maximum: 10 + weight: + type: number + format: float + description: Weight of the feedback, a float between 0 and 1. Default is 1.0. + minimum: 0 + maximum: 1 + default: 1.0 + metadata: + type: object + additionalProperties: true + description: Additional metadata for the feedback. + + RateLimits: + type: object + properties: + type: + type: string + enum: ["requests", "tokens"] + unit: + type: string + enum: ["rpd", "rph", "rpm"] + value: + type: integer + 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 + + 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 + + UpdateIntegrationRequest: type: object - title: File citation - description: | - A citation to a file. properties: - type: + name: type: string - description: | - The type of the file citation. Always `file_citation`. - enum: - - file_citation - x-stainless-const: true - index: - type: integer - description: | - The index of the file in the list of files. - file_id: + description: Human-readable name for the integration + example: "Production OpenAI" + key: type: string - description: | - The ID of the file. + 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 + + 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 + + GlobalWorkspaceAccess: + type: object required: - - type - - index - - file_id - FilePath: + - 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' + + OpenAIConfiguration: type: object - title: File path - description: | - A path to a file. properties: - type: + openai_organization: type: string - description: | - The type of the file path. Always `file_path`. - enum: - - file_path - x-stainless-const: true - file_id: + description: OpenAI organization ID + openai_project: type: string - description: | - The ID of the file. - index: - type: integer - description: | - The index of the file in the list of files. - required: - - type - - file_id - - index - DoneEvent: + description: OpenAI project ID + + AzureOpenAIConfiguration: type: object + required: + - azure_resource_name + - azure_deployment_config + - azure_auth_mode properties: - event: + azure_auth_mode: type: string - enum: ["done"] - data: + enum: [default, entra, managed] + description: Authentication mode for Azure + azure_resource_name: type: string - enum: ["[DONE]"] + description: Azure OpenAI resource name + azure_deployment_config: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/AzureDeploymentConfig' + # Entra-specific fields + 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) + # Managed identity fields + azure_managed_client_id: + type: string + description: Managed identity client ID (optional for managed auth) + + AzureDeploymentConfig: + type: object required: - - event - - data - description: Occurs when a stream ends. - x-code-samples: - dataDescription: "`data` is `[DONE]`" + - 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 - Batch: + BedrockConfiguration: type: object + required: + - aws_auth_type + - aws_region properties: - id: + aws_auth_type: type: string - object: + enum: [accessKey, assumedRole] + description: AWS authentication type + aws_region: type: string - enum: [batch] - description: The object type, which is always `batch`. - endpoint: + description: AWS region + # Access key fields + aws_access_key_id: type: string - description: The Portkey API endpoint used by the batch. + description: AWS access key ID (required for accessKey auth) + aws_secret_access_key: + type: string + description: AWS secret access key (required for accessKey auth) + # Assumed role fields + 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) - errors: - type: object + SageMakerConfiguration: + allOf: + - $ref: '#/components/schemas/BedrockConfiguration' + - type: object properties: - object: + amzn_sagemaker_custom_attributes: type: string - description: The object type, which is always `list`. - data: - type: array - items: - type: object - properties: - code: - type: string - description: An error code identifying the error type. - message: - type: string - description: A human-readable message providing more details about the error. - param: - type: string - description: The name of the parameter that caused the error, if applicable. - nullable: true - line: - type: integer - description: The line number of the input file where the error occurred, if applicable. - nullable: true - input_file_id: + 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 + + VertexAIConfiguration: + type: object + required: + - vertex_auth_type + - vertex_region + properties: + vertex_auth_type: type: string - description: The ID of the input file for the batch. - completion_window: + enum: [basic, serviceAccount] + description: Vertex AI authentication type + vertex_region: type: string - description: The time frame within which the batch should be processed. - status: + description: GCP region + # Basic auth fields + vertex_project_id: type: string - description: The current status of the batch. - enum: - - validating - - failed - - in_progress - - finalizing - - completed - - expired - - cancelling - - cancelled - output_file_id: + description: GCP project ID (required for basic auth) + # Service account fields + vertex_service_account_json: + type: object + description: Service account JSON (required for serviceAccount auth) + + AzureAIConfiguration: + type: object + required: + - azure_foundry_url + - azure_auth_mode + properties: + azure_auth_mode: type: string - description: The ID of the file containing the outputs of successfully executed requests. - error_file_id: + enum: [default, entra, managed] + description: Authentication mode for Azure AI + azure_foundry_url: type: string - description: The ID of the file containing the outputs of requests with errors. - created_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch was created. - in_progress_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch started processing. - expires_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch will expire. - finalizing_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch started finalizing. - completed_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch was completed. - failed_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch failed. - expired_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch expired. - cancelling_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch started cancelling. - cancelled_at: - type: integer - description: The Unix timestamp (in seconds) for when the batch was cancelled. - request_counts: - type: object - properties: - total: - type: integer - description: Total number of requests in the batch. - completed: - type: integer - description: Number of requests that have been completed successfully. - failed: - type: integer - description: Number of requests that have failed. - required: - - total - - completed - - failed - description: The request counts for different statuses within the batch. - metadata: - description: *metadata_description - type: object - x-oaiTypeLabel: map - nullable: true + 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 + # Entra-specific fields + 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) + # Managed identity fields + azure_managed_client_id: + type: string + description: Managed identity client ID (optional for managed auth) + + WorkersAIConfiguration: + type: object required: - - id - - object - - endpoint - - input_file_id - - completion_window - - status - - created_at + - workers_ai_account_id + properties: + workers_ai_account_id: + type: string + description: Cloudflare Workers AI account ID - BatchRequestInput: + HuggingFaceConfiguration: type: object - description: The per-line object of the batch input file properties: - custom_id: + huggingface_base_url: type: string - description: A developer-provided per-request id that will be used to match outputs to inputs. Must be unique for each request in a batch. - method: + description: Custom Hugging Face base URL + + CortexConfiguration: + type: object + required: + - snowflake_account + properties: + snowflake_account: type: string - enum: ["POST"] - description: The HTTP method to be used for the request. Currently only `POST` is supported. - url: + description: Snowflake account identifier + + CustomHostConfiguration: + type: object + properties: + custom_host: type: string - description: The Portkey API relative URL to be used for the request. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. - x-code-samples: - name: The request input object - example: | - {"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is 2+2?"}]}} + 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) - BatchRequestOutput: + IntegrationList: type: object - description: The per-line object of the batch output and error files properties: id: type: string - custom_id: + format: UUID + organisation_id: type: string - description: A developer-provided per-request id that will be used to match outputs to inputs. - response: - type: object - nullable: true - properties: - status_code: - type: integer - description: The HTTP status code of the response - request_id: - type: string - description: An unique identifier for the provider API request. Please include this request ID when contacting your provider support. - body: - type: object - x-oaiTypeLabel: map - description: The JSON body of the response - error: - type: object + 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 - description: For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure. - properties: - code: - type: string - description: A machine-readable error code. - message: - type: string - description: A human-readable error message. - x-code-samples: - name: The request output object - example: | - {"id": "batch_req_wnaDys", "custom_id": "request-2", "response": {"status_code": 200, "request_id": "req_c187b3", "body": {"id": "chatcmpl-9758Iw", "object": "chat.completion", "created": 1711475054, "model": "gpt-3.5-turbo", "choices": [{"index": 0, "message": {"role": "assistant", "content": "2 + 2 equals 4."}, "finish_reason": "stop"}], "usage": {"prompt_tokens": 24, "completion_tokens": 15, "total_tokens": 39}, "system_fingerprint": null}}, "error": null} - - ListBatchesResponse: + slug: + type: string + description: + type: string + object: + type: string + enum: [integration] + + IntegrationModelsResponse: type: object properties: - data: + total: + type: integer + description: Total number of models + models: type: array items: - $ref: "#/components/schemas/Batch" - first_id: + $ref: '#/components/schemas/IntegrationModel' + + IntegrationModel: + type: object + properties: + slug: type: string - example: "batch_abc123" - last_id: + description: Model slug identifier + name: type: string - example: "batch_abc456" - has_more: + description: Human-readable model name + enabled: type: boolean - object: + 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 - enum: [list] - required: - - object - - data - - has_more + nullable: true + description: Base model slug for fine-tuned models + pricing_config: + $ref: '#/components/schemas/PricingConfig' - FeedbackRequest: + PricingConfig: type: object - required: - - trace_id - - value properties: - trace_id: + type: type: string - description: Unique identifier for the request trace. - value: - type: integer - description: Feedback value, an integer between -10 and 10. - minimum: -10 - maximum: 10 - weight: + enum: [static] + description: Pricing type + pay_as_you_go: + $ref: '#/components/schemas/PayAsYouGoPricing' + + 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: Weight of the feedback, a float between 0 and 1. Default is 1.0. - minimum: 0 - maximum: 1 - default: 1.0 - metadata: - type: object - additionalProperties: true - description: Additional metadata for the feedback. + description: Price per token - FeedbackResponse: + BulkUpdateModelsRequest: type: object + required: + - models properties: - status: - type: string - description: success or failure - message: - type: string - description: Confirmation message indicating successful feedback submission. - feedback_ids: + models: type: array - description: Ids of Feedbacks created returned in the same order as input items: - type: string + $ref: '#/components/schemas/ModelUpdateRequest' + allow_all_models: + type: boolean + description: Whether to allow all models by default - FeedbackUpdateRequest: + ModelUpdateRequest: type: object required: - - value + - slug + - enabled properties: - value: + 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' + + IntegrationWorkspacesResponse: + type: object + properties: + total: type: integer - description: Feedback value, an integer between -10 and 10. - minimum: -10 - maximum: 10 - weight: - type: number - format: float - description: Weight of the feedback, a float between 0 and 1. Default is 1.0. - minimum: 0 - maximum: 1 - default: 1.0 - metadata: - type: object - additionalProperties: true - description: Additional metadata for the feedback. + description: Total number of workspaces + workspaces: + type: array + items: + $ref: '#/components/schemas/IntegrationWorkspace' - RateLimits: + IntegrationWorkspace: type: object properties: - type: + id: type: string - enum: ["requests"] - unit: + 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' + + 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 + + WorkspaceUpdateRequest: + type: object + required: + - id + - enabled + properties: + id: type: string - enum: ["rpm"] - value: - type: integer - UsageLimits: + 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. + + Providers: type: object properties: - credit_limit: - type: integer - description: Credit Limit. Used for tracking usage - minimum: 1 - default: null - alert_threshold: - type: integer - description: Alert Threshold. Used for alerting when usage reaches more than this - minimum: 1 - default: null - periodic_reset: + name: type: string - description: Reset the usage periodically. - enum: ["monthly"] - example: - credit_limit: 10 - periodic_reset: monthly - alert_threshold: 8 + 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] VirtualKeys: type: object