Managing API Hub for Contract Testing AI
Usage Limits
Access to the feature is limited by a credit system, where each generated test uses one credit. Credits reset on the first day of each calendar month, and usage is tracked monthly.
Credits are allotted to your account based on your plan:
PactFlow developer plans: 10 credits per month (total)
Enterprise Plus or plans with Contract Testing Pro Addon: 30 credits per purchased user per month
All other plans (Individual, Team, and Enterprise Plans): 10 credits per month
Note that credits are allocated to the organization, not individual users.
Examples
Consumption
Each successfully generated test consumes a credit. If your organization reaches its limit, you will see the following error:
ERROR: Client error: 403 Forbidden AI credits are exhausted.
Note
The limits and your usage against these limits are not currently visible on the subscription page. They may be checked via the pactflow-ai status
command.
Role Based Access Control (RBAC)
In addition to the system preference that enables AI within your workspace, API Hub for Contract Testing's RBAC model allows you to manage access to specific AI capabilities for your users. For detailed information, refer to the permissions documentation.
By default, users assigned the User role have access to all AI permissions (ai:*), unless:
Your account was created before the release of the AI feature (September 2024), or
You have customized your role configuration..
Granting Access:
To enable AI access for users, ensure that the assigned role includes either the ai:*
permission (granting access to all AI features) or the specific permissions required for the desired functionality. Once granted, access may be checked using the pactflow-ai status
command.
Configuring API Hub for Contract Testing AI
Managing the Feature
Access to PactFlow AI can be managed by a PactFlow Administrator (or user with the system_preference:manage:*
permission):
In the UI, navigate to Settings > Preferences > System Preferences.
Check the AI Test Generation checkbox.
Save the settings.
Configuring the CLI
The API Hub for Contract Testing AI CLI supports flexible configuration through environment variables and configuration files. It allows both user-level and local configuration, with local settings taking precedence.
Configuration Methods
Managing Configuration
You can inspect or modify settings with the following commands:
List all settings:
pactflow-ai config list
Retrieve a setting:
pactflow-ai config get broker.base-url
Override with an explicit file: Use
--config-file <path>
For advanced options, including certificate management for corporate environments, refer to:
pactflow-ai config --help