AI API Endpoints
Reference for the AI endpoint available through the Web3 Market API. This endpoint requires an X-API-Key header with a valid API key and a Pro plan subscription.
POST /api/ai/review
Performs a security review of Solidity contract source code. Returns a list of issues with severity levels and a summary.
Available via w3m audit --ai.
Request
{
"source": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n...",
"filename": "MyToken.sol"
}| Field | Type | Required | Description |
|---|---|---|---|
source | string | Yes | The full Solidity source code to review |
filename | string | Yes | The name or filename of the contract |
Response
{
"issues": [
{
"severity": "warning",
"description": "Unbounded loop in distribute() could exceed block gas limit",
"suggestion": "Consider implementing a batched distribution pattern"
}
],
"summary": "1 warning found. No critical issues detected."
}| Field | Type | Description |
|---|---|---|
issues | array | List of security issues found |
issues[].severity | string | One of critical, warning, or info |
issues[].description | string | Description of the issue |
issues[].suggestion | string | Suggested fix or improvement |
summary | string | Human-readable summary of the review |
Headers
| Header | Value | Required |
|---|---|---|
X-API-Key | Your Web3 Market API key | Yes |
Content-Type | application/json | Yes |
Error Handling
| Status | Meaning |
|---|---|
| 200 | Success |
| 400 | Invalid request body |
| 401 | Invalid or expired API key. Run w3m auth to authenticate. |
| 403 | AI contract review requires a Pro plan. Upgrade at web3.market/pricing. |
| 429 | Rate limit exceeded. Wait and try again. |
| 500 | Internal server error |
⚠️
The AI review endpoint requires a Pro plan. If your account is on the Free tier, requests will return a 403 error. Upgrade at web3.market/pricing.