Skip to content

Quickstart

This guide takes you from a new account to your first generation. You create an account and an API key, add balance, send a chat request, and check your balance. The base URL is https://api.sakuranbo.ai/v1.

Open the sign-up page of the dashboard and create an account. Follow the steps on the screen.

Open the API keys page of the dashboard and create a key. Give the key a name. You can also set a spending limit and an expiry date. See Balance and key limits.

The dashboard shows the full key once, right after you create it. Copy it then. A key starts with cherry_. Store it in the environment variable SAKURANBO_API_KEY, which all the examples in these docs read:

Terminal window
export SAKURANBO_API_KEY="paste-your-key-here"

Never put the key in client-side code or in a public repository. See Authentication.

Open the Billing page of the dashboard and add balance with a card or with crypto. The page shows the payment methods that you can use. The default minimum deposit is $10.00. See Pricing and billing for the details.

Send a request to POST /v1/chat/completions with your API key. The example uses the model sakuranbo/cherrytext-1.0-flash.

Terminal window
curl -X POST "https://api.sakuranbo.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SAKURANBO_API_KEY" \
-d '{
"model": "sakuranbo/cherrytext-1.0-flash",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Summarize the benefits of prepaid API credits in two lines."
}
],
"max_tokens": 2048
}'

You can send the same request with the OpenAI SDK. Set the base URL of the SDK to https://api.sakuranbo.ai/v1 and its API key to your Sakuranbo AI key.

OpenAI SDK for TypeScript:

import OpenAI from "openai";
const apiKey = process.env.SAKURANBO_API_KEY;
if (!apiKey) throw new Error("Set the SAKURANBO_API_KEY environment variable.");
const client = new OpenAI({
baseURL: "https://api.sakuranbo.ai/v1",
apiKey,
});
const completion = await client.chat.completions.create({
model: "sakuranbo/cherrytext-1.0-flash",
messages: [
{
role: "system",
content: "You are a concise assistant."
},
{
role: "user",
content: "Summarize the benefits of prepaid API credits in two lines."
}
],
max_tokens: 2048
});
console.log(completion.choices[0]?.message.content);

OpenAI SDK for Python:

import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.sakuranbo.ai/v1",
api_key=os.environ["SAKURANBO_API_KEY"],
)
completion = client.chat.completions.create(
model="sakuranbo/cherrytext-1.0-flash",
messages=[
{
"role": "system",
"content": "You are a concise assistant.",
},
{
"role": "user",
"content": "Summarize the benefits of prepaid API credits in two lines.",
},
],
max_tokens=2048,
)
print(completion.choices[0].message.content)

The response is a chat completion. The generated text is in choices[0].message.content. usage has the token counts and usage.cost, which is the amount that the request cost. usage.cost has the amount in micro USD as amount_micro_usd and as a decimal string in amount_usd.

Read your balance with GET /v1/balance.

Terminal window
curl "https://api.sakuranbo.ai/v1/balance" \
-H "Authorization: Bearer $SAKURANBO_API_KEY"

available_usd is the amount that new requests can use. held_usd is the amount that running requests have reserved. The request that you just sent is finished, so its reservation is gone and its cost is already taken out of available_usd.

  • Chat: streaming, the Anthropic-compatible endpoint, and the official SDKs.
  • Images and Videos: generate images and videos.
  • Estimate API: calculate the price of a request before you run it. It needs no API key.
  • Models API: list the models and read their input parameters and prices.
  • MCP server: connect a coding agent to Sakuranbo AI.