vicious-gold
vicious-gold2mo ago

hello I created 2 actors payment on

hello I created 2 actors payment on result with my own ai api key I have 2 problem I see that the api key was used and I don't see the run on apify analytics second problem I wan don't allow free users to run the actor cause I am paying the api call fees if this is not possible I am forced to disable this 2 actors
9 Replies
azzouzana
azzouzana2mo ago
The first problem could be because not all users consent to share their runs with the developers, and insights might be not updated in real-time For the second problem, yes you can know whether the running user is a paid Apify user. But even for free users I believe it might be worth it to give them a small credit so they try your actor and see its result.
flat-fuchsia
flat-fuchsia2mo ago
I can't pay ai runs for them till now I paid 10 $ and revenu it's -0.16$
MEE6
MEE62mo ago
@msaidwolf just advanced to level 4! Thanks for your contributions! 🎉
flat-fuchsia
flat-fuchsia2mo ago
can you show me how to disable free users
azzouzana
azzouzana2mo ago
you can check this env variable if (process.env.APIFY_USER_IS_PAYING === '1') But I also suggest is that you set some sort of rate limiting in your actor so free users would be allowed to run X amounts of external API call
flat-fuchsia
flat-fuchsia2mo ago
@azzouzana can you share with me doc link please 🙂
aciku
aciku2mo ago
Print all environment variables using a print statement in your preferred language. For example, these two might be useful for your case:
APIFY_USER_IS_PAYING =

APIFY_USER_PRICING_TIER = FREE
APIFY_USER_IS_PAYING =

APIFY_USER_PRICING_TIER = FREE
I assume APIFY_USER_IS_PAYING is a boolean value — if it’s empty, it means false, and if it contains 1 or any non-empty value, it means true. The APIFY_USER_PRICING_TIER indicates the user’s specific pricing plan (in this case, “FREE”).
No description
aciku
aciku2mo ago
Something like this, but in your preferred language:
use std::env;

fn main() {
println!("🔍 Listing all environment variables:\n");

for (key, value) in env::vars() {
println!("{key} = {value}");
}

println!("\n✅ Done listing environment variables.");
}
use std::env;

fn main() {
println!("🔍 Listing all environment variables:\n");

for (key, value) in env::vars() {
println!("{key} = {value}");
}

println!("\n✅ Done listing environment variables.");
}
Python =
import os

print("🔍 Listing all environment variables:\n")

for key, value in os.environ.items():
print(f"{key} = {value}")

print("\n✅ Done listing environment variables.")
import os

print("🔍 Listing all environment variables:\n")

for key, value in os.environ.items():
print(f"{key} = {value}")

print("\n✅ Done listing environment variables.")
JS =
console.log("🔍 Listing all environment variables:\n");

for (const [key, value] of Object.entries(process.env)) {
console.log(`${key} = ${value}`);
}

console.log("\n✅ Done listing environment variables.");
console.log("🔍 Listing all environment variables:\n");

for (const [key, value] of Object.entries(process.env)) {
console.log(`${key} = ${value}`);
}

console.log("\n✅ Done listing environment variables.");
Just do it in a separate actor as an exploration phase don’t include it in the final production actor. ⚠️

Did you find this page helpful?