Skip to content

Getting started

A call to the JSON API is one HTTPS POST of a JSON body to https://api.voplica.com. This page takes you from a new account to your first two calls: one that needs no key, and one made with your key.

  • An account. Sign in at voplica.com with Google or Apple. You must be at least 18 years old to use Voplica.
  • Credits, for the calls that cost something. API usage is paid with Anytime and Earned credits only — free credits and plan credits can’t be used for the API. A credit pack from the pricing page adds Anytime credits. Billing and limits explains what a call costs.
  • An API key, created below.
  1. In the studio, open Profile → API keys, at voplica.com/profile/api-keys.

  2. Give the key a name, for example the name of your app, and choose when it expires. In 90 days is preselected; you can also choose 30 or 365 days, or Never.

  3. Choose Create key, then Copy key. The key starts with pat_, and the studio shows it only this once.

  4. Keep the key on your server, for example in an environment variable:

    Terminal window
    export VOPLICA_API_KEY=pat_your_api_key

Some methods answer without a key. This one returns the model variant Voplica recommends as a starting point:

Terminal window
curl -X POST https://api.voplica.com/voplica.api.ai.model.ModelVariantService/GetRecommendedBaseModelVariant \
-H 'Content-Type: application/json' \
-d '{}'

The path is the method’s full name, /<package>.<Service>/<Method>. The body {} is a request with every field left unset. The answer is the response message as JSON, shortened here:

{
"modelVariant": {
"variantId": "…",
"variantName": "…",
"modelFamily": "…",
"status": "PUBLISHED",
"visibility": "PUBLIC"
}
}

This one returns your credit balance. The key goes in the Authorization header:

Terminal window
curl -X POST https://api.voplica.com/voplica.api.payment.PaymentService/GetBillingInfo \
-H "Authorization: Bearer $VOPLICA_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'

The answer, shortened:

{
"billingInfo": {
"accountId": "…",
"permanentCreditsMilli": "2500000",
"earnedCreditsMilli": "0"
}
}

permanentCreditsMilli is your Anytime credits and earnedCreditsMilli your Earned credits, both in thousandths of a credit. 64-bit numbers like these come back as JSON strings; the TypeScript client gives them as bigint values.