Files
ubicloud/routes/project/inference_playground.rb
Junhao Li a876d6d52c Add billing check and free quota for AI inference
Provide free quota for AI inference. Projects without valid billing info
will have requests rejected after the free quota is exhausted.
2025-02-18 11:51:51 -05:00

15 lines
655 B
Ruby

# frozen_string_literal: true
class Clover
hash_branch(:project_prefix, "inference-playground") do |r|
r.get web? do
@inference_endpoints = Serializers::InferenceEndpoint.serialize(inference_endpoint_ds.where(Sequel.pg_jsonb_op(:tags).get_text("capability") => "Text Generation"))
@inference_api_keys = Serializers::InferenceApiKey.serialize(inference_api_key_ds.all)
@remaining_free_quota = FreeQuota.remaining_free_quota("inference-tokens", @project.id)
@free_quota_unit = "inference tokens"
@has_valid_payment_method = @project.has_valid_payment_method?
view "inference/endpoint/playground"
end
end
end