Skip to content

Docs

POST /preview_ai_cost

https://heyeveryone.ai/api/v1/preview_ai_cost

Operation

{
  "post": {
    "description": "Credit cost of an in-app AI action before it runs. Pass the service name and its input (adapt_content is per channel). transcribe_media before its media is probed: `unknownUntilProbed`, `credits` is the minimum. AI runs (ask_workspace, repurpose_source, plan_content) return a `range`, charged by use; `credits` is its max.",
    "operationId": "preview_ai_cost",
    "requestBody": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "service": {
                "type": "string"
              },
              "input": {
                "additionalProperties": {},
                "default": {},
                "propertyNames": {
                  "type": "string"
                },
                "type": "object"
              }
            },
            "required": [
              "service"
            ],
            "type": "object"
          }
        }
      },
      "required": true
    },
    "responses": {
      "200": {
        "content": {
          "application/json": {
            "schema": {
              "additionalProperties": false,
              "properties": {
                "credits": {
                  "maximum": 9007199254740991,
                  "minimum": 0,
                  "type": "integer"
                },
                "description": {
                  "type": "string"
                },
                "unknownUntilProbed": {
                  "default": false,
                  "type": "boolean"
                },
                "range": {
                  "additionalProperties": false,
                  "properties": {
                    "min": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "max": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "typical": {
                      "anyOf": [
                        {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "min",
                    "max",
                    "typical"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "credits",
                "description",
                "unknownUntilProbed"
              ],
              "type": "object"
            }
          }
        },
        "description": "Success"
      },
      "400": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "invalid_input: the body does not match the schema"
      },
      "401": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "unauthenticated: missing, invalid, expired or revoked token"
      },
      "403": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "forbidden: the agent may not do this (for example, another workspace)"
      },
      "404": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "not_found"
      },
      "409": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "conflict"
      },
      "422": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Service-specific errors: not_ai_service"
      },
      "429": {
        "$ref": "#/components/responses/RateLimited"
      },
      "500": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "internal_error"
      }
    },
    "summary": "Preview an AI action's cost",
    "tags": [
      "account"
    ],
    "x-heyeveryone-kind": "query"
  }
}

Referenced definitions

{
  "schemas": {
    "Error": {
      "properties": {
        "error": {
          "description": "A stable error code, for example forbidden.",
          "type": "string"
        },
        "message": {
          "description": "What went wrong, in plain words.",
          "type": "string"
        }
      },
      "required": [
        "error",
        "message"
      ],
      "type": "object"
    }
  },
  "responses": {
    "RateLimited": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "description": "rate_limited: too many requests from this agent, account or address (docs/setup/agents.md, Rate limits); wait the Retry-After seconds, then retry",
      "headers": {
        "Retry-After": {
          "description": "Seconds to wait before retrying.",
          "schema": {
            "minimum": 1,
            "type": "integer"
          }
        }
      }
    }
  }
}

Authentication

{
  "bearer": {
    "description": "Personal access token (hey_pat_...)",
    "scheme": "bearer",
    "type": "http"
  },
  "oauth": {
    "flows": {
      "authorizationCode": {
        "authorizationUrl": "https://heyeveryone.ai/oauth/authorize",
        "refreshUrl": "https://heyeveryone.ai/oauth/token",
        "scopes": {
          "agent": "Act as your agent in the workspaces you choose"
        },
        "tokenUrl": "https://heyeveryone.ai/oauth/token"
      }
    },
    "type": "oauth2"
  }
}

Security requirements

[
  {
    "bearer": []
  },
  {
    "oauth": [
      "agent"
    ]
  }
]