Docs
Status
OverviewQuickstartSetup promptsThe core loopAuthenticationOverviewModelsThe waterfallAdding modelsAnthropic APIErrorsIntegrate the gatewayCost APIAccount APICoding agentsCredits & billingTelemetryAPI reference

Get started

  • Overview
  • Quickstart
  • Setup prompts
  • The core loop
  • Authentication

Guides

  • Overview
  • Models
  • The waterfall
  • Adding models
  • Anthropic API
  • Errors

Integrations

  • Integrate the gateway
  • Cost API
  • Account API
  • Coding agents

Billing & usage

  • Credits & billing
  • Telemetry

Reference

  • API reference
PreviousQuickstartNextThe core loop

Get started

Setup prompts

Paste one of these into your coding agent and it works with you to set things up: wire an OpenAI client to the gateway, or wire your coding agent to it. Each prompt is first-person, so pasting it is your instruction and consent.

How to use them

Copy a prompt below and paste it into a CLI coding agent (Claude Code, Codex, and the like). The agent follows it end to end. The prompts are the same ones the in-app onboarding uses, and they carry this deployment's URLs (web https://pr-1743.preview.experientiallabs.ai, API https://api-pr-1743.preview.experientiallabs.ai).

Agents can also read every prompt from /llms.txt, the machine-readable reference. Shareable copies live in the setup-prompts repository.

Create an account from your coding agent

Signed out? Paste this into a CLI agent to create your account instantly from your email, wire the gateway, and confirm the key.

prompt
1. Ask me for my email address. Ask me
directly ("What's your email? I'll create your Experiential Labs account
with it.") and wait for my answer. Use exactly the address I give you.
Never invent or guess an address, and never go looking for one in my
files, git config, or shell history. Call the result MY_EMAIL.
Show me the Terms (https://platform.experientiallabs.ai/terms) and Privacy (https://platform.experientiallabs.ai/privacy)
links and ask whether I agree to the terms and privacy conditions.
Wait for my affirmative answer before creating an account. Do not infer agreement.
2. Create my account instantly, no browser, no password, no code.
POST https://pr-1743.preview.experientiallabs.ai/api/signup/instant (no auth)
Header: Content-Type: application/json
Body: {"email": "<MY_EMAIL>", "agree": true}
On 200 capture: api_key (an xpl_ key, this is mine, keep it secret), org_id,
credits_granted, verification_required, overview_url. Handle the others:
- 409 account_exists -> I already have an account; stop and tell me to
sign in at https://pr-1743.preview.experientiallabs.ai/signin to get a key (don't retry with another email).
- 403 signup_disabled | signup_domain_blocked | work_email | signup_refused
-> the signup was refused; show me the response's
`error` text verbatim (it says what to do) and stop.
- 428 terms_acceptance_required -> show the policy links and ask for agreement.
- 429 rate_limited -> too many signups from here; wait, then retry once.
- 400 invalid_request -> the email was rejected; ask me for a valid one.
Store the api_key as EXPLABS_API_KEY in my env; never print the full key more
than once.
3. Wire an OpenAI client to the gateway.
base_url = "https://api-pr-1743.preview.experientiallabs.ai/v1"
api_key = EXPLABS_API_KEY (the xpl_ key from step 2). One header only:
Authorization: Bearer <api_key>.
4. Confirm the key is live, this does NOT spend credits.
GET https://api-pr-1743.preview.experientiallabs.ai/v1/models with the key -> the models my account can call. Do NOT
make a paid chat completion yet: follow the activation steps shown at
overview_url first. If payment is required, I complete it myself on
https://pr-1743.preview.experientiallabs.ai/credits. If manual review is required, help me submit an appeal and
wait for approval; payment cannot unlock that review. Landing my traces as
telemetry works regardless.

Set up the gateway in an existing project

Paste into your agent: it asks where to wire the gateway and which model to test, with a recommendation, then makes one call.

prompt
I'm setting up Experiential Labs as this project's model gateway. I pasted this
myself, treat it as my instructions and my consent. I'm already signed in; my key
is below. Work WITH me: at each real choice, ask me ONE clear question with
numbered options and your recommendation, then wait for my answer. Don't guess.
My gateway API key (a secret: put it in env, never commit it, never echo it in
logs):
EXPLABS_API_KEY=<paste my org API key from https://pr-1743.preview.experientiallabs.ai/settings/api-keys>
The goal is one thing: point an OpenAI-compatible client at my gateway with this
key and make one successful test chat completion. Print what you do at each step.
1. Ask me where to wire it (options + your recommendation), then wait. Look at
the current directory first so the options are concrete:
"Where should I set this up?
(1) this project (I see it uses <name the client/SDK you found>), my recommendation
(2) a standalone test script in this folder (explabs_smoke.py / .mjs)
(3) somewhere else, tell me where
Which one?"
For (1): set base_url = https://api-pr-1743.preview.experientiallabs.ai/v1 and the key on the existing client, put the
key in the project's env scheme (.env plus an example entry), never in code,
and show me the change first. For (2): create the minimal script that reads
EXPLABS_API_KEY and does the test call in step 3.
2. Ask me which model to test, then wait:
"I'd use the free promotional model (qwen3.8-27b at launch) so this test costs
nothing. Use that, or name another? GET https://api-pr-1743.preview.experientiallabs.ai/v1/models lists what my key
can call; use the ids EXACTLY as returned."
3. Make the test call with the model I chose. Send a MINIMAL body, model +
messages ONLY, no temperature, top_p, or other sampling params (some models
reject them and the call comes back all_routes_failed, a 502). One header:
Authorization: Bearer $EXPLABS_API_KEY. This runs on the platform-funded
lane, a fraction of a cent of my free credits, and proves serving and billing
end to end. Do NOT use any of my own provider keys for this test.
4. Report back what you changed and the test call (the model, that it succeeded,
and its cost). Then ask me which optional follow-ups I want, with your
recommendation, and do only the ones I pick:
(a) Connect my own provider keys (BYOK, Pro) so those calls bill my own accounts
(b) Import my Claude Code / Codex usage history (metadata only)
(c) Review my credits and spend
BYOK and import are quick for me to do at https://pr-1743.preview.experientiallabs.ai/settings; balances live at
https://pr-1743.preview.experientiallabs.ai/credits.
Read the contract if you build further: https://pr-1743.preview.experientiallabs.ai/docs (human docs) and
https://pr-1743.preview.experientiallabs.ai/llms.txt (machine-readable: honored and refused parameters, error codes,
streaming caveats). Follow it literally.

Wire your coding agent to the gateway

Paste into Claude Code, Codex, OpenCode, Hermes Agent, Pi, Cline, VS Code Copilot, Conductor, Cursor, or any OpenAI-SDK tool: the agent identifies itself and applies its own verified integration.

prompt
I pasted this into you myself, wire THIS coding agent up to my Experiential
Labs gateway, so my model calls route through https://api-pr-1743.preview.experientiallabs.ai and show up in my usage.
Ground rules: never print my full key (first 8 characters at most), ask me
before you edit any config file or shell profile, and if you cannot do a step
(no file access, settings live in a GUI), print the exact manual steps for me
instead. Print what you're doing at each step.
1. Get my key. Use EXPLABS_API_KEY from my environment if it is set; otherwise
ask me to paste one (I can mint it at https://pr-1743.preview.experientiallabs.ai/settings/api-keys). It looks
like xpl_ followed by 40 hex characters.
2. Prove the key works before touching any config:
GET https://api-pr-1743.preview.experientiallabs.ai/v1/models with header "Authorization: Bearer <key>" -> 200 and
the model slugs I can call. Remember the list; I'll pick models from it.
3. Identify which agent you are and apply YOUR integration:
- Claude Code:
You cannot repoint yourself mid-session, and switching auth under a running
session causes mixed-state errors. First prove the lane without touching any
config, via one isolated subprocess run from this project (so my MCP servers
and plugins load and their tool schemas ride the request. Tool schemas are
where provider strictness bites, so a bare hello proves too little):
ANTHROPIC_BASE_URL="https://api-pr-1743.preview.experientiallabs.ai" ANTHROPIC_API_KEY="<my key>" \
ANTHROPIC_MODEL="<slug I pick>" \
claude -p "list your available tools, then read ./README.md and reply
with its first heading"
Pass only if that run completes with tools listed and a real tool use.
Then offer me two placements and apply the one I pick:
(a) append to my shell profile, or (b) print for one-off use:
export ANTHROPIC_BASE_URL="https://api-pr-1743.preview.experientiallabs.ai" # no /v1 suffix
export ANTHROPIC_API_KEY="<my key>"
export ANTHROPIC_MODEL="<slug I pick>"
Use ANTHROPIC_API_KEY, never ANTHROPIC_AUTH_TOKEN: an existing claude.ai
sign-in can outrank AUTH_TOKEN and send the gateway an OAuth token instead.
Then tell me to start a NEW session from a shell with those set. Name the
model by its gateway slug exactly as GET https://api-pr-1743.preview.experientiallabs.ai/v1/models lists it (the DOT
form, e.g. claude-fable-5.1 — Anthropic's dashed ids like claude-fable-5-1
answer 403 model_not_granted). If the slug is not an Anthropic model, also
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=<context_window from
GET https://api-pr-1743.preview.experientiallabs.ai/api/models/<slug>> — Claude Code assumes 200k for names it does
not know and compacts early. Warn me plainly: if a session ever shows
"Not logged in · Please run /login", do NOT run /login (it starts Anthropic
OAuth that overrides the gateway) — restart with --resume, and if it
persists, my <config dir>/.claude.json remembers a "No" to the custom-API-key
prompt under customApiKeyResponses.rejected: answer Yes or move the entry to
approved. Images work on image-capable routes and are rejected by name on
text-only ones; extended thinking passes through on all-Anthropic routes
and is translated to reasoning effort elsewhere.
- Conductor:
Conductor launches Claude Code with the environment it captured from my
login shell (interactive login shell, cached per workspace) merged with its
own settings, and passes the per-chat picker choice as --model — so the
model is routed by remapping picker aliases with ANTHROPIC_DEFAULT_*_MODEL
variables (ANTHROPIC_MODEL does not apply to picker selections). Offer me
two placements and apply the one I pick:
(a) per-repo, recommended: merge into this repo's .claude/settings.json
"env" block (committed; Claude Code applies it in every workspace, and it
overrides anything Conductor captured from my shell), one
ANTHROPIC_DEFAULT_<ALIAS>_MODEL entry per picker alias I use:
{ "env": { "ANTHROPIC_BASE_URL": "https://api-pr-1743.preview.experientiallabs.ai",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "<slug I pick>" } }
then put ONLY the key machine-local in .conductor/settings.local.toml
under [environment_variables] (make sure that file is
git-ignored before writing my key into it):
ANTHROPIC_API_KEY = "<my key>"
(b) app-wide: print the same variables for me to add by hand in
Conductor -> Settings -> Environment, and remind me to check that
Settings -> Harnesses -> Claude Code uses my API key, not a claude.ai
CLI login.
Warn me either way: settings reach newly created workspaces, not running
ones, and if my shell profile exports a direct Anthropic
ANTHROPIC_API_KEY, Conductor's capture hands it to every agent —
placement (a) overrides it; otherwise I should remove the export.
The key rides ANTHROPIC_API_KEY, never ANTHROPIC_AUTH_TOKEN: an existing
claude.ai sign-in can outrank AUTH_TOKEN, and a set API key also stops
Claude Code from trying to authenticate with Anthropic directly.
- OpenAI Codex CLI:
First prove the lane in a throwaway home so my real ~/.codex (config,
sessions, auth) stays untouched, and test with my REAL tool surface: you
send every mcp_servers/plugin tool schema on each request, and tool schemas
are where provider strictness bites, so a bare hello proves too little.
Copy ~/.codex into a fresh "$(mktemp -d)", append ONLY the
[model_providers.explabs] table below to that copy's config.toml, then run
CODEX_HOME=<that dir> codex exec -m "<slug I pick>" \
-c model_provider=explabs -c model_reasoning_effort=max \
"list your available tools, then read ./README.md and reply with its
first heading"
Pass only if it completes with my MCP/plugin tools listed and a real tool
use. Then add the whole block to ~/.codex/config.toml (create it if
missing, show me the diff before writing) and tell me to start a new Codex
session:
model = "<slug I pick>"
model_provider = "explabs"
model_reasoning_effort = "max" # reasoning models; "max" is the top tier
[model_providers.explabs]
name = "Experiential Labs"
base_url = "https://api-pr-1743.preview.experientiallabs.ai/v1"
env_key = "EXPLABS_API_KEY"
wire_api = "responses"
Leave requires_openai_auth unset, and make sure EXPLABS_API_KEY is exported
where I launch you (export KEY=..., a plain KEY=... line is invisible to
child processes like me).
- OpenCode:
Write the provider block into this project's opencode.json (or
~/.config/opencode/opencode.json if I prefer global, ask):
{"provider": {"explabs": {"npm": "@ai-sdk/openai-compatible",
"name": "Experiential Labs",
"options": {"baseURL": "https://api-pr-1743.preview.experientiallabs.ai/v1", "apiKey": "{env:EXPLABS_API_KEY}"},
"models": {"<slug>": {"name": "<slug>"}}}}
Fill limit.context/limit.output and cost ({"input": $/1M, "output": $/1M},
i.e. the catalog's *_micro_usd_per_million / 1000000) for each slug from
GET https://api-pr-1743.preview.experientiallabs.ai/api/models/<slug> so my context window and spend display are right.
- Hermes Agent (Nous Research):
First prove the lane in a throwaway data dir so my real ~/.hermes (config,
sessions, memories) stays untouched: create "$(mktemp -d)", write ONLY the
config below plus a .env line EXPLABS_API_KEY=<my key> (chmod 600) into it,
then run
HERMES_HOME=<that dir> hermes -z "list your available tools, then read
./README.md and reply with its first heading"
Pass only if that run completes with tools listed and a real tool
round-trip. Then merge the same block into ~/.hermes/config.yaml (show me
the diff before writing) and put the key line in ~/.hermes/.env:
providers:
explabs:
base_url: "https://api-pr-1743.preview.experientiallabs.ai/v1"
key_env: "EXPLABS_API_KEY"
api_mode: chat_completions
model:
provider: "custom:explabs"
default: "<slug I pick>"
Any catalog slug works as the default, and /model custom:explabs:<slug>
switches mid-session. Warn me plainly: Hermes' session-title side call
sends a temperature value, so on models that pin their sampling the title
falls back to a default — the session itself is unaffected.
- Pi:
First prove the lane in a throwaway home so my real ~/.pi (auth, sessions,
model store) stays untouched: pi resolves its agent dir from HOME, so create
"$(mktemp -d)" and copy my real ~/.pi into it (extensions, skills, and
settings ride the test — tool schemas are where provider strictness bites,
so a defaults-only run proves too little; if ~/.pi does not exist yet, just
create <that dir>/.pi/agent). Then merge the block below into that copy's
.pi/agent/models.json and run
HOME=<that dir> EXPLABS_API_KEY=<my key> pi -p --provider explabs \
--model "<slug I pick>" "list your available tools, then read
./README.md and reply with its first heading"
Pass only if that run completes with tools listed and a real tool
round-trip, then DELETE the throwaway home ("rm -rf <that dir>") — the copy
carries my auth and session state and must not outlive the proof. Then
merge the same provider into ~/.pi/agent/models.json
(create it as {"providers": {}} if missing; show me the diff before
writing):
{ "providers": { "explabs": {
"baseUrl": "https://api-pr-1743.preview.experientiallabs.ai/v1",
"api": "openai-completions",
"apiKey": "$EXPLABS_API_KEY",
"models": [ { "id": "<slug I pick>", "name": "<slug I pick>",
"reasoning": true, "input": ["text", "image"],
"contextWindow": <from GET https://api-pr-1743.preview.experientiallabs.ai/api/models/<slug>>,
"maxTokens": <from the same> } ] } } }
The apiKey stays the literal string "$EXPLABS_API_KEY" — pi interpolates it
from my environment, so make sure the variable is exported where I launch
pi and never write the raw key into the file. Set reasoning/input to the
slug's actual catalog capabilities. Any catalog slug works; I pick models
with --model at launch or /model in-session (models.json reloads each time
/model opens, no restart).
- Cline:
Your settings live in the VS Code UI, so print these for me to set by hand:
API Provider "OpenAI Compatible"; Base URL https://api-pr-1743.preview.experientiallabs.ai/v1; API Key = my key (no
Bearer prefix); Model ID = a slug from step 2; and per-model context window /
max output tokens from https://api-pr-1743.preview.experientiallabs.ai/api/models/<slug>.
- VS Code (Copilot Chat):
Copilot's bring-your-own-model support is VS Code core (1.122+); chat and
agent mode need no Copilot plan. Find my VS Code user dir (macOS
~/Library/Application Support/Code/User, Linux ~/.config/Code/User, Windows
%APPDATA%\Code\User) and merge this entry into chatLanguageModels.json
there (create the file as a JSON array if missing), one models[] item per
slug I pick:
{ "name": "Experiential Labs", "vendor": "customendpoint",
"apiType": "chat-completions",
"models": [ { "id": "<slug I pick>", "name": "<slug I pick>",
"url": "https://api-pr-1743.preview.experientiallabs.ai/v1/chat/completions",
"toolCalling": true, "vision": true,
"modelOptions": { "temperature": null, "top_p": null } } ] }
Set toolCalling and vision to each slug's ACTUAL capabilities from
GET https://api-pr-1743.preview.experientiallabs.ai/api/models/<slug> (tool support and image input) — declaring a
capability the model lacks makes Copilot send tool calls or images the
route rejects.
The null modelOptions are required, not decoration: null deletes the field,
and Copilot otherwise sends temperature 0.1 and top_p 1 on every request,
which models that pin their sampling reject with a 400 naming the
parameter. You cannot enter my key — it lives in VS Code's encrypted secret
storage — so print the manual step: in the Chat model picker open Manage
Models, right-click the Experiential Labs model, choose to enter an API
key, and paste my key (<my key>). VS Code stores it encrypted and writes
the ${input:chat.lm.secret.*} references into the entry itself; never
hand-write a raw key into the file.
- Cursor:
Your gateway settings live in the Cursor Settings UI, so print these for me
to set by hand. First tell me the prerequisite: a paid Cursor plan (the Free
plan serves only Auto and refuses named models, which custom models are).
Then: in Cursor Settings -> Models -> API Keys, put my key in
"OpenAI API Key" (no Bearer prefix), enable "Override OpenAI Base URL" and
set it to https://api-pr-1743.preview.experientiallabs.ai/v1. Add each slug I pick as a custom model
name in the models list; custom models ride the override in OpenAI format,
so any catalog slug works. Warn me plainly: Cursor relays requests through
its own servers, Tab autocomplete stays on Cursor's models, and if a chat
answers 400 invalid_parameter naming temperature or top_p, that model pins
its sampling (the Claude 5 family pins temperature to 1). Pick a
different slug.
- Any other OpenAI-compatible tool:
Export OPENAI_BASE_URL="https://api-pr-1743.preview.experientiallabs.ai/v1" and OPENAI_API_KEY="<my key>" wherever I
launch you, and name models by slug. If your own config wants the values
instead, it needs the same three: base URL https://api-pr-1743.preview.experientiallabs.ai/v1, my key, and a slug.
4. Verify end to end. Make one tiny completion with the surface you configured
("reply with the single word: ok", small max output), via your own next
model call if you now route through the gateway, otherwise via curl with my
key. Then tell me it landed and that I can watch every call at
https://pr-1743.preview.experientiallabs.ai/telemetry.
5. Recap exactly what you changed (files and values, key shown as xpl_ prefix
only) so I can undo it later.

Switch from your current provider or gateway

Paste into your coding agent: it finds the existing integration, moves the base URL and key, maps model ids against the live catalog, moves cost reads onto the Cost API, and verifies with one call.

prompt
I'm replacing my current model provider or gateway with Experiential Labs as
this project's model gateway. I pasted this myself: treat it as my instructions
and my consent. Work WITH me: at each real choice, ask me ONE clear question
with numbered options and your recommendation, then wait. Don't guess. Print
what you do at each step, and never print my full API key (first 8 characters
at most). Read the full machine-readable contract first: https://pr-1743.preview.experientiallabs.ai/llms.txt (base
URLs, every route, honored and refused parameters, cost fields, error codes).
Follow it literally.
1. Find the current integration. Search this project for the provider's base
URL, its key variable, its SDK/client construction, hardcoded model ids,
provider-specific request fields (provider preferences, transforms,
fallback model lists, referer/title headers), and any code that reads cost
or usage from it. Show me the list of files and call sites before changing
anything.
2. Get my Experiential key. Ask me: "Do you have an xpl_ key already?
(1) yes, I'll paste it
(2) no, create my account"
For (2): ask me for my email (never scavenge one from my files or git
config), show me https://pr-1743.preview.experientiallabs.ai/terms and https://pr-1743.preview.experientiallabs.ai/privacy and wait for my
agreement, then
POST https://pr-1743.preview.experientiallabs.ai/api/signup/instant (no auth)
Header: Content-Type: application/json
Body: {"email": "<MY_EMAIL>", "agree": true}
On 200 capture api_key. On 409 account_exists tell me to sign in at
https://pr-1743.preview.experientiallabs.ai/signin for a key and stop. On any other error show me the response's
`error` text verbatim and stop.
Store the key as EXPLABS_API_KEY in my env scheme (.env plus an example
entry), never in code.
3. Switch the base URL. The gateway keeps the path shapes my current
integration already uses:
base URL: https://api-pr-1743.preview.experientiallabs.ai/api/v1
auth: Authorization: Bearer $EXPLABS_API_KEY (the ONLY header needed)
POST /chat/completions, /responses, /messages (Anthropic Messages API) and
GET /models work unchanged. Plain OpenAI or Anthropic SDKs can also use the
bare base https://api-pr-1743.preview.experientiallabs.ai/v1. Remove the provider-specific headers and request
fields from step 1: the gateway does provider routing (fallback, caching)
itself and unknown parameters may be rejected. Send model + messages and
only the parameters I actually rely on.
4. Map model ids. GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/models with my key (free; this does not
spend credits) lists the slugs I can call. For each model id from step 1,
propose the matching slug (e.g. "claude-fable-5.1") and ask me to confirm
the mapping before replacing. Use slugs EXACTLY as returned.
5. Move cost and usage reads over.
- Every chat/responses reply carries usage.cost (USD, what I was charged)
and usage.is_byok; on a stream it rides the final usage chunk. No flag
needed. Exception: a request sent with Idempotency-Key carries no
usage.cost at all (original or replay), so read the field as optional.
- One request: read the x-request-id response header and call
GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/generation?id=<that id>.
- Balance: GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/credits. Recent activity:
GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/activity.
- Billing feed: GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/usage is the settled per-request export
(cost_usd, estimated_cost_usd, real_cost_usd, tokens, attribution_label,
api_key_id), newest first inside a lookback window (24h|7d|30d); its
next_cursor pages OLDER within one call and is not a resume checkpoint.
Each run scans from the top and dedupes on the row id.
- If I rebill my own customers, pass their stable id as safety_identifier
(alias: user) on every request; it comes back as attribution_label.
Replace my old provider's cost/usage code with these; show me the diff
first.
6. Key management (only if my code creates or rotates keys programmatically).
https://api-pr-1743.preview.experientiallabs.ai/api/v1/keys (GET/POST/PATCH/DELETE) requires a PROVISIONING key: an
xpl_ key minted with "provisioning": true. The first one is created from
the dashboard at https://pr-1743.preview.experientiallabs.ai/api-keys (org admin, "Provisioning key" option).
Tell me to mint it and paste it as a separate server-side secret; never use
it for inference traffic.
7. Verify. Make ONE minimal test call (model + messages only, no sampling
parameters) with a free promotional model from the /models list, or one I
name. Report the model, that it succeeded, and its usage.cost. If it fails
with a credits or activation error, tell me to finish activation at https://pr-1743.preview.experientiallabs.ai
and stop; do not retry with another provider. Then run the project's
existing tests.
8. Report back: every file changed, the model-id mapping, what happened to the
old provider key (tell me to revoke it at the old provider; don't delete it
yourself), and the test call result. Human docs if you need more:
https://pr-1743.preview.experientiallabs.ai/docs/integrate.

Integrate the gateway into your product

Paste into your coding agent: it wires a client, attributes every request to your end-customer, builds the billing sync on the settled usage export, and offers key-per-customer.

prompt
I'm integrating Experiential Labs into this product as its model gateway: my
product calls models through it and meters or rebills my own end-users. I
pasted this myself: treat it as my instructions and my consent. Work WITH me:
at each real choice, ask me ONE clear question with numbered options and your
recommendation, then wait. Don't guess. Print what you do at each step, and
never print my full API key (first 8 characters at most). Read the full
machine-readable contract first: https://pr-1743.preview.experientiallabs.ai/llms.txt (base URLs, every route,
honored and refused parameters, cost fields, error codes). Follow it literally.
1. Get my Experiential key. Ask me: "Do you have an xpl_ key already?
(1) yes, I'll paste it
(2) no, create my account"
For (2): ask me for my email (never scavenge one from my files or git
config), show me https://pr-1743.preview.experientiallabs.ai/terms and https://pr-1743.preview.experientiallabs.ai/privacy and wait for my
agreement, then
POST https://pr-1743.preview.experientiallabs.ai/api/signup/instant (no auth)
Header: Content-Type: application/json
Body: {"email": "<MY_EMAIL>", "agree": true}
On 200 capture api_key. On 409 account_exists tell me to sign in at
https://pr-1743.preview.experientiallabs.ai/signin for a key and stop. On any other error show me the response's
`error` text verbatim and stop.
Store the key as EXPLABS_API_KEY in my env scheme (.env plus an example
entry), never in code.
2. Wire the client. Ask me where (options + your recommendation, based on what
you see in this project), then wait. Configure an OpenAI-compatible or
Anthropic client with:
base URL: https://api-pr-1743.preview.experientiallabs.ai/api/v1 (inference, model discovery, cost, and
account routes under one base; plain OpenAI / Anthropic SDKs
may also use https://api-pr-1743.preview.experientiallabs.ai/v1)
auth: Authorization: Bearer $EXPLABS_API_KEY (the ONLY header needed)
POST /chat/completions, /responses, or /messages (Anthropic Messages API).
Name models by slug EXACTLY as GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/models returns them
(free; this does not spend credits). Send model + messages and only the
parameters I actually rely on; unknown parameters may be rejected.
3. Attribute every request to my end-customer. Pass their stable id as
safety_identifier (alias: user) on every request. It comes back as
attribution_label on the usage export, so I can group cost and tokens by
my own customer id with ONE key. Ask me what my customer id looks like and
wire it through from where my code knows the customer.
4. Read cost.
- Inline: every chat/responses reply carries usage.cost (USD, what I was
charged) and usage.is_byok; on a stream it rides the final usage chunk.
No flag needed, but a request sent with Idempotency-Key carries no
usage.cost at all (original or replay), so read it as optional. Show it
in my product where it helps; do not treat it as the billing record.
- One request: read the x-request-id response header and call
GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/generation?id=<that id>.
- Balance: GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/credits (data.total_credits - data.total_usage).
5. Build the billing sync on the settled export. Ask me which billing system I
use (Metronome, Orb, Stripe metered billing, my own tables, or none yet),
then write a scheduled job that:
- reads GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/usage?limit=1000 (settled rows, newest first
inside a lookback window: window=24h|7d|30d, default 7d; filterable by
attribution_label, model, api_key_id, status). next_cursor
({cursor_ts, cursor_id, cursor_after}, passed back as query params)
pages OLDER within this one call and is NOT a checkpoint to resume from
next run: each run starts at the top, follows next_cursor until a whole
page is older than the last successful run's start time minus a grace
period covering my longest request, and dedupes on the row id. Schedule
it at least daily; rows older than 30 days are no longer exportable.
- lands each row in a local outbox table keyed on the row id (insert, on
conflict do nothing) in one local transaction, then in a separate
delivery step pushes unsent rows to the billing system and marks them
sent (an external HTTP write cannot share my database transaction; the
outbox makes a crash between the two safe to replay),
- sends one usage event per row: customer from attribution_label,
transaction_id / idempotency key = the row id, timestamp = created_at,
quantity = the cost column I choose (below) plus token counts if I meter
on tokens; the margin is a rate in the billing system, not in this job.
Cost columns: cost_usd is the platform credits charged; estimated_cost_usd
is the attributed value of a BYOK row (served on my own provider key) at
catalog list rates, an estimate and never the provider's invoice;
real_cost_usd is the two added together. Ask me whether to bill
real_cost_usd (accepting the BYOK estimate) or cost_usd plus tokens on
BYOK rows. pricing_known false means unpriced (cost 0), not free.
6. Key-per-customer (optional; ask me). If I want each customer isolated to
their own key with independent revocation and a daily USD cap, that needs
a PROVISIONING key: an xpl_ key minted with "provisioning": true. The
first one comes from the dashboard at https://pr-1743.preview.experientiallabs.ai/api-keys (org admin,
"Provisioning key" option); keep it server-side and never use it for
inference. With it: POST https://api-pr-1743.preview.experientiallabs.ai/api/v1/keys {name, limit, provisioning}
returns the plaintext key exactly once; GET/PATCH/DELETE
https://api-pr-1743.preview.experientiallabs.ai/api/v1/keys/{hash} list, update (disabled:true revokes), and revoke.
A normal inference key gets 403 on every /keys route.
7. Verify. Make ONE minimal test call (model + messages only) with a free
promotional model from the /models list, or one I name, carrying a test
safety_identifier. Report the model, that it succeeded, and its usage.cost;
then confirm the row shows up on GET https://api-pr-1743.preview.experientiallabs.ai/api/v1/usage with that
attribution_label. If the call fails with a credits or activation error,
tell me to finish activation at https://pr-1743.preview.experientiallabs.ai and stop. Then run the project's
existing tests.
8. Report back: every file changed, where the key lives, how customer
attribution flows, and the billing job's schedule and cursor storage.
Human docs if you need more: https://pr-1743.preview.experientiallabs.ai/docs/integrate, https://pr-1743.preview.experientiallabs.ai/docs/cost-api,
and https://pr-1743.preview.experientiallabs.ai/docs/account-api.

See also

Prefer to wire it by hand? The Quickstart makes the first call in a minute, and Coding agents has per-agent configuration.