Get Started
Build with Hikigai
Set up your workspace, deploy your first AI agent, then add the apps that use it: a web app, an Android app or an iOS app. Agents, apps and MCP servers run on GCP or AWS, on Hikigai's cloud or your own.
How it fits together
A project holds your agents (the AI), your apps (what your users open) and your MCP servers (tools the agents call). Apps are the only thing that can call agents at runtime, so the usual path is: set up → deploy an agent → try it in the playground → add an app that calls it.
Create Your Account
First, you'll need a Hikigai account. Signing in creates your personal workspace automatically.
Personal account limits (Free)
- 1 project · 2 agents · 0 apps / mobile apps / MCP servers
- 10 requests/min · 20 requests/day · 5 agent invokes/day
- Deploys use Hikigai's platform cloud (no team cloud account needed)
- Personal workspaces cannot invite members
Apps need Pro (ask a Hikigai admin) or a team organization. Exceeding a limit returns HTTP 429 until the window resets. Full matrix: Usage Limits.
Staying personal?
Skip to Step 5: Create Project and deploy from your personal workspace. Continue below when you need a shared team org.
Create an Organization
Team organizations share projects, members, cloud accounts, and LLM keys. They run as Enterprise and deploy into your own cloud (not Hikigai's platform account).
- Inherit: members can work on every project at their org role level.
- Explicit: members only reach projects they are added to. Owners always see everything.
Enterprise on your cloud
Team projects cannot deploy until an organization (or project) cloud account is linked. Complete Step 3 before deploying.
Link Cloud Accounts & Add LLM Keys
In a team org, configure shared defaults under Organization Settings. Owners and admins can edit these.
Link cloud accounts (your own cloud)
Add organization LLM keys (BYOK)
Personal vs team
Personal projects can deploy on Hikigai's platform cloud without a cloud account. Team organizations must use an org or project cloud account. LLM keys are optional but recommended so billing and quotas stay with your providers.
Add Members & Access
Manage the roster from Organization Members or Organization Settings. Assign each person a role that matches what they should do.
| Role | Can do |
|---|---|
| Owner | Full control: members, settings, plan, delete organization. |
| Admin | Manage projects, members, cloud accounts, and LLM keys. |
| Release Engineer | Builds and deploys agents and apps. |
| Agentic / App Developer | Agentic: agents. App Developer: apps and consuming agents. |
| Tester | Read and invoke only; good for QA and stakeholders. |
Create a Project
Projects organize agents, apps, and MCP servers. Create them in the workspace selected in the org switcher (personal or team).
Configure Your Agent
Configure your agent with the form; no code needed.
Agent Name
clinical-note-summarizer. Apps call the agent by this name (its slug).Description
Instruction
You are a clinical documentation assistant. Convert patient encounter transcripts into structured SOAP notes. Extract symptoms, vital signs, diagnoses, and treatment plans.Model
Input Schema
{
"type": "object",
"properties": {
"transcription": { "type": "string", "description": "Raw patient visit transcript" },
"patient_id": { "type": "string", "description": "Patient identifier" }
},
"required": ["transcription"]
}Output Schema
{
"type": "object",
"properties": {
"subjective": { "type": "string" },
"objective": { "type": "string" },
"assessment": { "type": "string" },
"plan": { "type": "string" }
}
}Cloud target
Deploy Your Agent
Prefer code? Deploy from your computer with the SDK (AgentClient().deploy(…)) after hikigai login.
Test Your Agent
Try your agent in the console right away:
Calling the agent from your own code
- While you develop: from your computer, after hikigai login (6 hours, your project, your role).
- In production: from an app you add to the project (next step): a deployed web app, or a registered Android / iOS app.
Anything else is refused: an old project API key gets 401 PROJECT_KEYS_REMOVED, and a token copied out of the console gets 401 as well. This keeps your agents and your bill safe even if a key leaks.
Add an App
In your project open Apps → New App and choose what you are building:
| App type | What you do | What you get |
|---|---|---|
| Web App | Deploy your code from GitHub or a ZIP | A live HTTPS URL. Your server code calls agents with the SDK |
| Android | Register your app (package name) | A config file (hikigai-services.json) with your app's gateway URL |
| iOS | Register your app (bundle ID) | A config file (HikigaiService-Info.plist) with your app's gateway URL |
| Android + iOS | React Native / Flutter: register both at once | One registration and config file per platform |
9a. Web App
Your code runs on Hikigai (GCP or AWS) and gets a live HTTPS URL. Your server code calls agents directly; no keys to manage.
Deploying a web app
- 1YouChoose your code
Apps → New App → Web App → GitHub repository, or a ZIP upload.
- 2YouCheck the settings
Name, port, build / start commands, size, cloud. Most are detected for you.
- 3HikigaiBuild and deploy
Detects the framework, builds the container, runs it on GCP or AWS. You watch the live log.
- 4HikigaiYour app is live
A live HTTPS URL, with the HIKIGAI_* variables set inside the app.
What happens when a user uses your web app
- 1User’s browserUser clicks something in your app
The browser calls your own server route, e.g. POST /api/analyze.
- 2Your app (server)Your server calls the agent
With the SDK: client.agent("icd-10-coder").invoke(note). It uses HIKIGAI_PLATFORM_URL and the app key for you.
- 3HikigaiHikigai checks it is your deployed app
Calls from anywhere else are refused.
- 4Your agentThe agent answers
The answer goes back to your server, which sends it to the browser.
Deploy
.zip of your project, up to 500 MB).Configure fields
App Name
patient-portal.Description (optional)
Root Directory (GitHub, for monorepos)
apps/web. Leave empty for the repository root.Build Command / Start Command
npm run build / npm start). Change them only if your project needs something else.Port
PORT: listen on process.env.PORT / os.environ["PORT"].CPU / Memory
Cloud target
Supported frameworks
Detected automatically. If your repository has its own Dockerfile (in the root directory), it is used instead.
| Framework | Detected by | Default port |
|---|---|---|
| Next.js / Nuxt | next, nuxt in package.json | 3000 |
| React / Vue (Vite or CRA) | react-scripts, @vitejs/plugin-react, vue | 3000 |
| Express / Node.js | express | 3000 |
| FastAPI | fastapi / uvicorn in requirements.txt | 8000 |
| Flask / Django / Python | requirements.txt or pyproject.toml | 8000 |
| Go | go.mod | 8080 |
| Static HTML | index.html | 3000 |
Environment variables
Hikigai sets these in your app. The HIKIGAI_* variables are locked (you can't change them); PORT follows the Port field unless you set your own PORT in the Environment tab:
| Variable | What it is |
|---|---|
HIKIGAI_PLATFORM_URL | The address your server code uses for every Hikigai call (agents, rooms, MCP, …). |
HIKIGAI_API_KEY | Your app’s key. A new one on every deployment; it only works from inside this app. The SDK uses it for you. |
HIKIGAI_PROJECT_ID | Your project. |
HIKIGAI_APP_ID | This app. |
HIKIGAI_PUBLIC_PLATFORM_URL | Hikigai’s public address, for code that runs in the browser. |
PORT | The port to listen on (the Port field). |
Your own variables (database URLs, third-party keys, feature flags) go in the app's Environment tab. Mark secrets as secret; they are encrypted. Redeploy to apply changes. Never put keys in your repository.
Notifications
Your server sends notifications with client.notifications.publish(…) to topics the project's Notifications tab allows this app on. Browsers get them by web push, with a key Hikigai made for your organization (nothing to sign up for): serve hikigai-sw.js from your site's root, call enableWebPush from @hikigai/app-sdk/browser in the page, and register the result from your server with registerBrowser / register_browser. See Node App SDK → Notifications.
Manage
- Redeploy rebuilds from GitHub (or reuses the uploaded build). With GitHub, every push to the branch redeploys automatically.
- Stop / Resume turns the app off and on. Rollback returns to an earlier deployment.
- Logs / Metrics show build logs, runtime logs and traffic. Settings has a custom domain and Delete.
Deploy fails or the app won't start?
Your server must listen on PORT and answer GET / with a success response (the health check). Check the build log and the Logs tab.
9b. Android App
Your app stays on your users' phones. You register it, and Hikigai gives it its own gateway URL: the app calls your agents, rooms and MCP servers there. Only your real app can use it (App Check), and you choose what it may call.
Setting up an Android app (once)
- 1YouRegister the app
Apps → New App → Android: package name, fingerprints, what it may use.
- 2HikigaiCreates your gateway URL
Shows Building, then Live (a few minutes).
- 3YouDownload the config file
hikigai-services.json → put it in the app folder. It holds gateway_url.
- 4YouCreate a debug token
Development registrations only, for debug builds. It works only together with proof from your app (package name + signing key), so a copy is useless elsewhere.
What your app does when a user uses it
- 1Your mobile appGet an App Check token
Challenge first, then Play Integrity (phones with Google Play) or Key Attestation (phones without). Debug builds add the debug token.
POST {gateway_url}/v1/app-check/exchange { "platform": "android", "challenge": "…", "integrity_token": "…" } - 2HikigaiChecks it is your real app
Package name and signing key must match. Returns an App Check token, valid 15 minutes (5 with a debug token).
{ "app_check_token": "eyJ…", "expires_in": 900 } - 3Your mobile appCall the agent
Send the token in a header, as often as needed.
POST {gateway_url}/v1/agents/cpt2-code-agent/invoke X-Hikigai-App-Check: eyJ… { "message": "Patient seen for…" } - 4HikigaiChecks the session and what the app may use
Refuses with APP_CHECK_REQUIRED, NOT_ALLOWED or LOGIN_REQUIRED if something is wrong.
- 5Your agentThe agent answers
The answer comes back to your app.
Register
Apps → New App → Android → Next, then fill in:
Nickname (optional)
Android package name
applicationId in Android Studio: Gradle Scripts → build.gradle.kts (Module :app) → defaultConfig. Must match exactly; it can't be changed later.SHA-256 signing certificate fingerprints
- Debug builds: in Android Studio's Terminal run
.\gradlew signingReport(Windows) or./gradlew signingReport(Mac/Linux), copy SHA-256 under Variant: debug. Each developer's machine has its own debug key: add each one (remove it to cut that developer off), or share one team debug keystore and keep it private. - Release (Google Play): Play Console → your app → Test and release → App integrity → App signing → App signing key certificate → SHA-256.
- Release APKs shared as a file (Google Drive, chat): add the Upload key certificate SHA-256 from the same page; those APKs are signed with your upload key.
Play Integrity key
- Play Console → your app → Test and release → App integrity → link a Google Cloud project. Your Google account must be an Owner of the project, or Play shows "Project not found"; a new project just for this is simplest.
- In that Google Cloud project, enable the Google Play Integrity API.
- IAM & Admin → Service accounts → Create (no roles needed), then Keys → Add key → JSON, and upload the file here.
Mode
What the app may use
visit-*, or * for every room. Anything not allowed is refused with NOT_ALLOWED.Require a signed-in end user for every call
/v1/auth/login (see Sign users in below).Where the backend runs
Click Register. The app's page opens and shows Building, then Live(a few minutes). Everything below is on its Overview tab. All settings except the package name can be changed later. A new app starts in Development, so debug tokens work for test builds. Before publishing, add the release fingerprints and the Play Integrity key, then click Promote to production on the Overview tab (debug tokens stop working; the config file stays the same).
Add the config file
build.gradle.kts.gateway_url from it, for example into BuildConfig (below), then click Sync Project with Gradle Files.{
"config_version": 1,
"project_id": "9016559f-…",
"mobile_app_id": "1:9016559f:android:0f16d82127f64e7e",
"platform": "android",
"package_name": "com.example.myapp",
"gateway_url": "https://android-myapp-backend-9016559f.apps.hikigaiplatform.io"
}// app/build.gradle.kts
val hikigai = groovy.json.JsonSlurper()
.parseText(file("hikigai-services.json").readText()) as Map<*, *>
android {
buildFeatures { buildConfig = true }
defaultConfig {
buildConfigField("String", "HIKIGAI_GATEWAY_URL", "\"${hikigai["gateway_url"]}\"")
}
}Nothing in the file is secret. It stays the same when the backend is redeployed; download it again only if you delete the app and register it again.
Your gateway URL
gateway_url in the config file is the address your app sends every request to. You can also see it at the top of the app's page in the console, under its name. In this guide, {gateway_url} means that address. For example, with the file above:
{gateway_url}/v1/app-check/exchange → https://android-myapp-backend-9016559f.apps.hikigaiplatform.io/v1/app-check/exchangeGet an App Check token
Every call needs an App Check token in the X-Hikigai-App-Check header. It is valid for 15 minutes (5 with a debug token); get a new one when it expires or when a call returns 401. Changing a security setting of the app (what it may use, sign-in, mode, keys) or Revoke all mobile sessions ends every phone's session, so phones get a new token.
Every build, debug or release, proves it is your app the same way: it asks for a one-time challenge, gets it signed, and sends the result. Hikigai checks that the package name and the signing key match this registration.
POST {gateway_url}/v1/app-check/challenge → { "challenge": "…", "expires_in": 300 } (one use, 5 minutes).com.google.android.play:integrity), a standard request with requestHash set to the challenge (or a classic request with setNonce(challenge)).POST {gateway_url}/v1/app-check/exchange
{ "platform": "android", "challenge": "…", "integrity_token": "…" } // with Google Play
{ "platform": "android", "challenge": "…", "key_attestation": ["MIIC…", …] } // without Google Play
// debug builds: either body plus "debug_token": "hkdbg_…"
→ 200 { "app_check_token": "eyJ…", "expires_in": 900, "verified": true } // 300 with a debug tokenThe whole thing in Kotlin (copy it as it is):
// app/build.gradle.kts
dependencies { implementation("com.google.android.play:integrity:<latest>") }
val local = java.util.Properties().apply {
rootProject.file("local.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) }
}
android {
buildTypes {
// The debug token lives in local.properties (hikigai.debugToken=hkdbg_…), never in Git or release builds.
getByName("debug") { buildConfigField("String", "HIKIGAI_DEBUG_TOKEN", "\"${local.getProperty("hikigai.debugToken", "")}\"") }
getByName("release") { buildConfigField("String", "HIKIGAI_DEBUG_TOKEN", "\"\"") }
}
}// AppCheck.kt (run off the main thread)
import android.content.Context
import android.os.Build
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.util.Base64
import com.google.android.gms.tasks.Tasks
import com.google.android.play.core.integrity.IntegrityManagerFactory
import com.google.android.play.core.integrity.StandardIntegrityManager.PrepareIntegrityTokenRequest
import com.google.android.play.core.integrity.StandardIntegrityManager.StandardIntegrityTokenRequest
import java.net.HttpURLConnection
import java.net.URL
import java.security.KeyPairGenerator
import java.security.KeyStore
import org.json.JSONArray
import org.json.JSONObject
const val CLOUD_PROJECT_NUMBER = 123456789012L // Google Cloud project linked in Play Console
// Show e.message to the user: it says why the phone was refused.
class AppCheckException(message: String) : Exception(message)
fun getAppCheckToken(context: Context): String {
val challenge = post("/v1/app-check/challenge", JSONObject()).getString("challenge")
val body = JSONObject().put("platform", "android").put("challenge", challenge)
try {
// Phones with Google Play: Google signs the challenge.
val manager = IntegrityManagerFactory.createStandard(context)
val provider = Tasks.await(manager.prepareIntegrityToken(
PrepareIntegrityTokenRequest.builder().setCloudProjectNumber(CLOUD_PROJECT_NUMBER).build()))
val token = Tasks.await(provider.request(
StandardIntegrityTokenRequest.builder().setRequestHash(challenge).build()))
body.put("integrity_token", token.token())
} catch (e: Exception) {
// No Google Play (e.g. Huawei): the phone's secure hardware signs it.
body.put("key_attestation", JSONArray(keyAttestationChain(challenge)))
}
if (BuildConfig.HIKIGAI_DEBUG_TOKEN.isNotEmpty()) body.put("debug_token", BuildConfig.HIKIGAI_DEBUG_TOKEN)
return post("/v1/app-check/exchange", body).getString("app_check_token")
}
fun keyAttestationChain(challenge: String): List<String> {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
throw AppCheckException("This phone can't be verified: it needs Google Play or Android 7 or later.")
}
val alias = "hikigai-app-check"
val generator = KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_EC, "AndroidKeyStore")
generator.initialize(
KeyGenParameterSpec.Builder(alias, KeyProperties.PURPOSE_SIGN)
.setDigests(KeyProperties.DIGEST_SHA256)
.setAttestationChallenge(challenge.toByteArray(Charsets.UTF_8))
.build()
)
generator.generateKeyPair() // replaces the previous key under this alias
val keyStore = KeyStore.getInstance("AndroidKeyStore").apply { load(null) }
return keyStore.getCertificateChain(alias).map { Base64.encodeToString(it.encoded, Base64.NO_WRAP) }
}
fun post(path: String, json: JSONObject): JSONObject {
val conn = URL(BuildConfig.HIKIGAI_GATEWAY_URL + path).openConnection() as HttpURLConnection
conn.requestMethod = "POST"
conn.doOutput = true
conn.setRequestProperty("Content-Type", "application/json")
conn.outputStream.use { it.write(json.toString().toByteArray(Charsets.UTF_8)) }
val ok = conn.responseCode < 300
val text = (if (ok) conn.inputStream else conn.errorStream).bufferedReader().readText()
if (!ok) {
// e.g. { "detail": { "code": "APP_CHECK_FAILED", "message": "This phone can't be verified: …" } }
val reason = runCatching { JSONObject(text).getJSONObject("detail").getString("message") }.getOrNull()
throw AppCheckException(reason ?: "App Check failed (${conn.responseCode})")
}
return JSONObject(text)
}CLOUD_PROJECT_NUMBER is the number of the Google Cloud project you linked for the Play Integrity key (Google Cloud console → project dashboard → Project number). Play Integrity has no stable device ID, so without sign-in each new token is a new anonymous user: agent conversations start over every 15 minutes. Turn on sign-in if your app needs continuity.
Debug tokens (development registrations only)
local.properties as hikigai.debugToken=hkdbg_… (the Gradle setup above reads it into debug builds only).Which build uses what
- Debug build (Android Studio, a debug APK you share): proof + device debug token. Works on development registrations only.
- Emulator (Google Play system image): Play Integrity + emulator debug token (6 hours).
- Release build installed from Google Play, including internal testing: Play Integrity. No token; works on development and production registrations.
- Release APK shared as a file (Google Drive, chat): Play Integrity, as long as its signing key (usually your upload key) is registered.
- Phones without Google Play (e.g. newer Huawei): Key Attestation. Google-certified phones work today; if phones from another manufacturer are refused, the Overview tab says so and Hikigai adds that manufacturer.
- Rooted phones, unlocked bootloaders and emulators are refused in production.
Sign users in (optional)
If your app has users, add them on the app's User Management tab (email, password, role, metadata such as a patient id), then sign them in from the app. The gateway signs users in against that same list; the phone never names a user list.
POST {gateway_url}/v1/auth/login
X-Hikigai-App-Check: <app_check_token>
{ "email": "pat@clinic.com", "password": "…" }
→ 200 { "id_token": "eyJ…", "access_token": "eyJ…", "refresh_token": "eyJ…", "expires_in": 3600, … }
GET {gateway_url}/v1/auth/me Authorization: Bearer <id_token> → { "email", "first_name", "role", "metadata", … }
POST {gateway_url}/v1/auth/refresh { "refresh_token": "…" } → new id_token (do this every hour)
POST {gateway_url}/v1/auth/logout Authorization: Bearer <id_token> → signs out everywhere; delete the saved tokens
POST {gateway_url}/v1/auth/forgot-password { "email" } → POST /v1/auth/reset-password { "email", "code", "new_password" }Send the ID token as Authorization: Bearer on every call when sign-in is required. Sign-in calls are limited to 20 a minute from one address. The app can also create an account (/v1/auth/signup); roles and metadata are set in User Management. Full list: API Reference → Mobile Apps.
Call your agents
POST {gateway_url}/v1/agents/{agent}/invoke
Content-Type: application/json
X-Hikigai-App-Check: <app_check_token>
Authorization: Bearer <id_token from /v1/auth/login> (only if sign-in is required)
{ "message": "Patient seen for a 30 minute follow-up of hypertension…" }// Kotlin (run off the main thread)
val conn = URL("${BuildConfig.HIKIGAI_GATEWAY_URL}/v1/agents/cpt2-code-agent/invoke")
.openConnection() as HttpURLConnection
conn.requestMethod = "POST"
conn.doOutput = true
conn.setRequestProperty("Content-Type", "application/json")
conn.setRequestProperty("X-Hikigai-App-Check", appCheckToken)
val payload = org.json.JSONObject().put("message", note).toString()
conn.outputStream.use { it.write(payload.toByteArray(Charsets.UTF_8)) }
val body = (if (conn.responseCode < 300) conn.inputStream else conn.errorStream)
.bufferedReader().readText()The response is the agent's normal response (same as calling it from a web app). All endpoints:
| Endpoint | Use |
|---|---|
POST /v1/auth/login · refresh · logout, GET /v1/auth/me | Sign users in (users from the User Management tab) |
POST /v1/agents/{agent}/invoke | Call an agent, get the full answer |
POST /v1/agents/{agent}/stream | Call an agent, stream the answer (server-sent events) |
POST /v1/agents/{agent}/live/session | Start a live voice session with a live agent |
POST /v1/rooms/{room}/token | Token to join a WebSocket room |
POST /v1/webrtc/{room}/media-token | Token to join a WebRTC call |
POST /v1/mcp/{server} | Send an MCP request to one of your MCP servers |
/v1/notifications/* | Register for notifications, get them live or from the inbox (see Notifications below) |
Notifications
Your deployed apps and the console can send notifications to the app (project → Notifications). No Firebase account is needed. The app talks to its gateway:
- or _) and keep it. Send it as X-Hikigai-Installation-Id on every notifications call, with the App Check header (and the sign-in token when sign-in is required).POST /v1/notifications/devices with the time zone, language and, if you use Google's messaging library, the FCM token.GET /v1/notifications/stream open (server-sent events; reconnect when it ends after about 5 minutes). Messages arrive at once.GET /v1/notifications/inbox to pick up what it missed.POST /v1/notifications/receipts with the message's delivery_id and "opened".POST {gateway_url}/v1/notifications/devices
X-Hikigai-App-Check: <app_check_token>
X-Hikigai-Installation-Id: <your install ID>
{ "timezone": "America/Chicago", "language": "en", "push_token": "<FCM token, if any>" }
→ 200 { "device_id": "…", "channel": "fcm", "topics": [], "room": … } // "direct" without a tokenReaching a closed app
Without a Google key a message waits until the app next fetches its inbox, usually within 1 to 9 minutes of the app waking on its own timer. For instant delivery (optional): in the Firebase console add your Android app, then Project settings → Service accounts → Generate new private key. Add PUSH_FCM_SERVICE_ACCOUNT with the whole JSON file in the mobile app's Environment tab and Redeploy the gateway. Put google-services.json and Google's messaging library in the app and send the FCM token when registering. The key stays in the gateway, in your own cloud.
All notification routes: API Reference → Mobile notifications.
Errors
Errors from the gateway look like { "detail": { "code": "…", "message": "…" } }:
| HTTP | Code | What to do |
|---|---|---|
| 401 | APP_CHECK_REQUIRED | Missing or expired App Check token, or the session was revoked: get a new one. |
| 401 | APP_CHECK_FAILED | The exchange was refused (bad, revoked or proof-less debug token, failed Play Integrity or Key Attestation, used or expired challenge). The message says which. |
| 401 | LOGIN_REQUIRED | Sign-in is required: send the user’s sign-in token. |
| 403 | NOT_ALLOWED | The agent or MCP server is not allowed for this app (What the app may use). |
| 429 | RATE_LIMITED | More than 120 requests a minute from one device, more than 10,000 a minute for the whole app, or more than 30 App Check requests a minute from one address. Slow down. |
| 503 | APP_CHECK_FAILED | App Check is briefly unavailable. Try again in a few seconds. |
Any other error comes from the agent or the platform and is passed through as it is. Full reference: API Reference → Mobile Apps.
9c. iOS App
Same idea as Android: register the app, add the config file, get an App Check token, and call your gateway URL. Apple App Attest proves it's your real app.
Register
Apps → New App → iOS → Next:
iOS bundle ID
Apple Team ID
Nickname, Mode, What the app may use, Sign-in, Where the backend runs
React Native or Flutter: choose Android + iOS. You get one app per platform, each with its own config file (android/app/hikigai-services.json and ios/…/HikigaiService-Info.plist).
Add the config file
let url = Bundle.main.url(forResource: "HikigaiService-Info", withExtension: "plist")!
let config = NSDictionary(contentsOf: url)!
let gatewayURL = config["GATEWAY_URL"] as! StringGet an App Check token
Simulator: App Attest doesn't work there, so use an emulator debug token (24 hours, development registrations only): { "debug_token": "hkdbg_…" }. Xcode builds on a real iPhone send App Attest as below plus a device debug token; that token is refused without App Attest for this Team ID and bundle ID, so a copy is useless in another app.
Real devices: App Attest
Getting an App Check token on a real iPhone (App Attest)
- 1Your mobile appAsk for a challenge
POST {gateway_url}/v1/app-check/challenge → { "challenge": "q8Xr…", "expires_in": 300 } - 2Google / AppleApple signs it
First time on this device: generateKey + attestKey. After that: generateAssertion. Both with SHA-256 of the challenge.
- 3Your mobile appSend it to Hikigai
POST {gateway_url}/v1/app-check/exchange { "platform": "ios", "challenge": "…", "key_id": "…", "attestation" | "assertion": "…" } - 4HikigaiChecks it with Apple’s rules
Returns an App Check token, valid 15 minutes.
- 5Your mobile appCall your agents with the token
Same as Android: X-Hikigai-App-Check header on every call.
POST {gateway_url}/v1/app-check/challenge.DCAppAttestService.shared.generateKey() (save the key ID in the Keychain), then attestKey(keyId, clientDataHash: SHA256(challenge)), and send the attestation.generateAssertion(keyId, clientDataHash: SHA256(challenge)).POST {gateway_url}/v1/app-check/exchange
// first time
{ "platform": "ios", "challenge": "…", "key_id": "…", "attestation": "<base64>" }
// later
{ "platform": "ios", "challenge": "…", "key_id": "…", "assertion": "<base64>" }
// Xcode builds: either body plus "debug_token": "hkdbg_…"
→ 200 { "app_check_token": "eyJ…", "expires_in": 900, "verified": true } // 300 with a debug token// AppCheck.swift
import CryptoKit
import DeviceCheck
func appCheckToken() async throws -> String {
let service = DCAppAttestService.shared
var body: [String: Any] = ["platform": "ios"]
var newKeyId: String?
if service.isSupported { // false in the Simulator
let challenge = try await post("/v1/app-check/challenge", [:])["challenge"] as! String
let hash = Data(SHA256.hash(data: Data(challenge.utf8)))
body["challenge"] = challenge
if let keyId = loadKeyId() { // from the Keychain
body["key_id"] = keyId
body["assertion"] = try await service.generateAssertion(keyId, clientDataHash: hash).base64EncodedString()
} else {
let keyId = try await service.generateKey()
body["key_id"] = keyId
body["attestation"] = try await service.attestKey(keyId, clientDataHash: hash).base64EncodedString()
newKeyId = keyId
}
}
#if DEBUG
body["debug_token"] = hikigaiDebugToken // device token on an iPhone, emulator token in the Simulator
#endif
let token = try await post("/v1/app-check/exchange", body)["app_check_token"] as! String
if let keyId = newKeyId { saveKeyId(keyId) } // keep the key only once Hikigai accepted it
return token
}post sends JSON to {gateway_url} and returns the decoded response; loadKeyId / saveKeyId keep the key ID in the Keychain. Keep hikigaiDebugToken out of Git (e.g. a local, git-ignored .xcconfig).
Which build uses what (iPhone)
- Simulator: emulator token. Development registrations only; stops after 24 hours.
- Xcode build on a real iPhone: App Attest (development environment) plus a device debug token. Accepted by development registrations only.
- TestFlight and App Store: App Attest (production environment). Accepted by development and production registrations, so TestFlight works before you promote. Share builds with TestFlight: internal testers (up to 100, no review) or external testers (first build needs Apple's Beta App Review). Never ship a debug token in these builds.
Needs the App Attest capability in Xcode and the Apple Team ID on the registration; there is no key file or account to link. If App Check fails, the backend's Logs tab shows the reason on the /v1/app-check/exchange line.
Call your agents
var request = URLRequest(url: URL(string: "\(gatewayURL)/v1/agents/cpt2-code-agent/invoke")!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue(appCheckToken, forHTTPHeaderField: "X-Hikigai-App-Check")
request.httpBody = try JSONSerialization.data(withJSONObject: ["message": note])
let (data, response) = try await URLSession.shared.data(for: request)Endpoints and errors are the same as on Android.
Notifications
The app makes the same calls as on Android (installation ID, register, stream while open, inbox on wake, receipts), sending the APNs device token when it registers. Every iPhone notification goes through Apple, so the gateway needs your Apple key:
PUSH_APNS_KEY (paste the whole .p8 file), PUSH_APNS_KEY_ID and PUSH_APNS_TEAM_ID (your Apple Team ID), then Redeploy the gateway. The key stays in the gateway, in your own cloud.push_token.POST {gateway_url}/v1/notifications/devices
X-Hikigai-App-Check: <app_check_token>
X-Hikigai-Installation-Id: <your install ID>
{ "push_token": "<APNs device token>", "timezone": "Europe/London", "language": "en" }
→ 200 { "device_id": "…", "channel": "apns", … }
// Xcode builds use Apple's sandbox: on a production registration add "apns_environment": "sandbox"The project's Notifications tab shows whether the gateway has the Apple key. Use "options": { "private": true } on health messages (a top-level private is ignored): the lock screen shows only "New notification" and the app reads the message from its inbox.
Call Hikigai from your App
In a deployed web app, the SDK reads the variables Hikigai set and handles the token for you. Create the client with no arguments, in your server code (API routes, backend):
How your server calls an agent
- 1Your app (server)Swap the app key for an access token
The SDK does this for you.
POST $HIKIGAI_PLATFORM_URL/api/v1/auth/exchange X-API-Key: $HIKIGAI_API_KEY
- 2HikigaiChecks it is your deployed app
Returns an access token, valid 5 minutes.
{ "access_token": "eyJ…", "expires_in": 300 } - 3Your app (server)Call the agent with the token
POST $HIKIGAI_PLATFORM_URL/api/v1/agents/icd-10-coder/invoke Authorization: Bearer eyJ…
- 4Your agentThe agent answers
The answer comes back to your server code.
# Python: pip install hikigai-appsdk
from hikigai.appsdk import AppClient
client = AppClient() # reads HIKIGAI_API_KEY, HIKIGAI_PROJECT_ID, HIKIGAI_PLATFORM_URL
@app.post("/analyze")
async def analyze(note: str):
response = client.agent("icd-10-coder").invoke(note)
return {"answer": response.content}// Node.js: npm install @hikigai/app-sdk
import { AppClient } from "@hikigai/app-sdk";
const client = new AppClient();
export async function POST(req) {
const { note } = await req.json();
const agent = await client.agent("icd-10-coder");
const response = await agent.invoke(note);
return Response.json({ answer: response.content });
}Without the SDK (any language)
Exchange the app's key for an access token, then send it on every call. The token lasts 5 minutes: get a new one before it expires, or when a call returns 401.
# 1. access token (valid 5 minutes)
curl -X POST "$HIKIGAI_PLATFORM_URL/api/v1/auth/exchange" \
-H "X-API-Key: $HIKIGAI_API_KEY" \
-H "X-Project-ID: $HIKIGAI_PROJECT_ID"
# → { "access_token": "eyJ…", "expires_in": 300, ... }
# 2. call an agent (by its name/slug)
curl -X POST "$HIKIGAI_PLATFORM_URL/api/v1/agents/icd-10-coder/invoke" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "X-Project-ID: $HIKIGAI_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{ "message": "Patient presents with acute chest pain…" }'
# → { "output": { ... }, "agent_id": "…", "status": "success", "session_id": "…", "latency_ms": 812, ... }HIKIGAI_PLATFORM_URL, HIKIGAI_API_KEY and HIKIGAI_PROJECT_ID from the environment; never copy their values into code. The key changes on every deployment. Browser code should call your own server routes, which then call Hikigai.Streaming, live sessions, rooms, storage, end-user sign-in and more: SDK Reference and API Reference.
Develop on your computer
Sign your terminal in with your Hikigai account. Then your code can call agents, streams, live voice, rooms, speech and MCP from your computer, and deploy or manage what your role allows. No key to copy.
# Python (the command comes with hikigai-appsdk / hikigai-agentsdk)
pip install hikigai-appsdk
hikigai login
# Node.js
npm install @hikigai/app-sdk
npx @hikigai/app-sdk login- The terminal shows a code and opens your browser on the console (sign in if asked).
- Pick the project, check that the code is the same as in the terminal, then click Approve.
- The terminal says Signed in. Your code now uses this login.
To skip choosing in the browser, name the project: hikigai login --project <project-id>. The project ID is on the project's page in the console.
from hikigai.appsdk import AppClient
client = AppClient() # your computer: the hikigai login · deployed App: HIKIGAI_API_KEY
response = client.agent("icd-10-coder").invoke("Patient presents with acute chest pain…")
print(response.content)The same code runs unchanged when you deploy it. Other commands:
hikigai whoami # who is signed in, for which project, until when
hikigai token # print the token, e.g. for curl or Postman:
curl "https://backend.hikigaiplatform.io/api/v1/agents/icd-10-coder/invoke" \
-H "Authorization: Bearer $(hikigai token)" -H "X-Project-ID: <project-id>" \
-H "Content-Type: application/json" -d '{ "message": "…" }'
hikigai logout # end it now- A login lasts 6 hours. Then run
hikigai loginagain. - It works for one project. For another project, log in again with its ID.
- You get your role in that project: Owners, Admins, Agentic Developers and Release Engineers can also deploy agents (
AgentClient().deploy(…)); App Developers can create and deploy apps but not agents; Testers can read and call agents only. - It does not work inside deployed Apps; they use their own
HIKIGAI_API_KEY. - See or end your logins in the console under CLI logins. Removing someone from the project ends their logins at once.
- The login is saved in
~/.hikigai/credentials.json, readable only by you. Python and Node.js share it.
Deploy & manage with plain HTTP
Everything the console does is also an HTTP API. From your computer, send the token from your hikigai login (hikigai token). It works for the project you signed in to, with your role there. There are no long-lived project API keys.
TOKEN=$(hikigai token)
# Create a web app from GitHub (install the Hikigai GitHub App once, from the console)
curl -X POST "https://backend.hikigaiplatform.io/api/v1/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "name": "patient-portal", "source_type": "github",
"github_repo_url": "https://github.com/acme/patient-portal", "github_branch": "main" }'
# Deploy it
curl -X POST "https://backend.hikigaiplatform.io/api/v1/projects/$PROJECT_ID/apps/$APP_ID/deploy" \
-H "Authorization: Bearer $TOKEN"
# …or deploy a ZIP instead (app created with "source_type": "upload")
curl -X POST "https://backend.hikigaiplatform.io/api/v1/projects/$PROJECT_ID/apps/$APP_ID/deploy/upload" \
-H "Authorization: Bearer $TOKEN" -F "file=@app.zip"
# Agent routes also need the project ID (deployment_status: pending | deploying | active | error | failed)
curl "https://backend.hikigaiplatform.io/api/v1/agents/my-agent" \
-H "Authorization: Bearer $TOKEN" -H "X-Project-ID: $PROJECT_ID"Old project API keys (hikigai_uni_…) no longer work: they get 401 PROJECT_KEYS_REMOVED. /api/v1/auth/exchange only takes a deployed App's own key (that is how apps get their 5-minute token).
All endpoints (apps, mobile apps, agents, MCP servers): API Reference.
MCP Servers
MCP servers give agents tools. Two options:
- Deploy your own: project → MCP Servers → New, pick a GitHub repository (Python or Node). Hikigai builds and deploys it, checks it answers MCP, and lists its tools.
- Use a connector: link a ready-made one from Connectors (e.g. Epic EHR, Cerner, Athena Health, Google Health Connect) and set its credentials in the project.
Use connectors when calling an agent from your app:
result = client.agent("clinical-note-coder").invoke(
{"note": "Patient presents with acute chest pain…"},
connectors={"my-ehr-connector": {}},
)To call one of your MCP servers directly from a web app, ask Hikigai for an MCP token (a 1-hour ticket for that one server), then send it to the server in the header returned:
# 1. The App's token (inside the deployed App; the SDK does this for you)
POST $HIKIGAI_PLATFORM_URL/api/v1/auth/exchange
X-API-Key: $HIKIGAI_API_KEY
X-Project-ID: $HIKIGAI_PROJECT_ID
→ { "access_token": "…" } # on your computer: use $(hikigai token) instead
# 2. The MCP token
POST $HIKIGAI_PLATFORM_URL/api/v1/mcp/access-token
Authorization: Bearer <access_token>
{ "server": "my-mcp-server" }
→ { "token": "…", "header": "X-Hikigai-Mcp-Token", "mcp_url": "https://…" }
# 3. Call the MCP server with your MCP client
POST <mcp_url>
X-Hikigai-Mcp-Token: <token>Full details and SDK examples: API reference → MCP Servers.
Mobile apps use POST {gateway_url}/v1/mcp/{server} instead (see Android).
Your Own Cloud
Agents, apps and MCP servers deploy to Google Cloud or AWS. Without a cloud account they run on Hikigai's cloud (personal projects). Team organizations attach their own (Step 3), and everything then runs in your account.
Google Cloud (GCP)
APIs and service-account roles to enable before you attach a key
Amazon Web Services (AWS)
IAM role, cluster and registry setup
The cloud target picker in every deploy form lists what your account supports. From code: client.cloud.catalog(workload="agent") (SDK) or GET /api/v1/cloud/catalog.
Rooms & Event Bus
- WebSocket rooms: project-scoped pub/sub (join, publish, presence, replay). Typical use: one client publishes live transcript events, others listen. API reference.
- WebRTC: audio, video and in-call chat through Hikigai's media server. SDKs:
connect_media/connectMedia. API reference. - Events & webhooks: get platform events (agent deployed, jobs, invocations, storage, WebRTC) as signed webhooks or a live stream. Set them up in the project's Webhooks tab.
Speech: Translate & Transcribe
Live speech without deploying an agent: WS /api/v1/speech/translate (speech-to-speech, 75+ languages) and WS /api/v1/speech/transcribe (speech-to-text, 85+ locales, live partial results). Any project with a Google Cloud account (Project settings or Organization settings → Cloud accounts); billed to your cloud. Try them in the project's Voice Lab tab, then use client.speech from your app. See API reference → Speech.
Limits
Limits depend on your plan. Exceeding one returns HTTP 429. What counts toward your quota: Usage Limits.
| Plan | Projects | Agents | Invokes/day | Apps | MCP | Req/min | Req/day |
|---|---|---|---|---|---|---|---|
| Free | 1 | 2 | 5 | 0 | 0 | 10 | 20 |
| Pro | 5 | 10 | 50 | 2 | 2 | 100 | 3,000 |
| Enterprise | Unlimited | Unlimited | Unlimited | Unlimited | Unlimited | 200 | 10,000 |