One API key can give an agent access to multiple tools when a shared platform authenticates the caller and executes authorized operations on its behalf. The key represents access to that platform. It does not make every supplier account, permission, or bill the same.
For developers, the benefit is fewer credentials distributed across agent projects and a consistent execution contract. The important design question is how that key is constrained. A useful shared credential should make the intended work easier while keeping unrelated capabilities unavailable.
This guide follows a single key through discovery, account selection, execution, and revocation, using o11’s implemented request shape as a concrete example.
The key is an identity boundary
An agent application needs a way to identify itself to the tool service. A bearer key supplies that identity at the HTTP boundary. The service then resolves the workspace and policy associated with that key before admitting work.
This separates the runtime credential from supplier credentials. The runtime can request a permitted search operation without carrying the supplier’s secret. A connected account remains stored and managed in its own account context.
That separation also clarifies ownership. A result belongs to the workspace and caller under which it was created. A random invocation identifier must not become access to another workspace’s data. Authentication alone is insufficient; retrieval and resource operations need ownership checks as well.
In o11’s current public transport, the Authorization header carries an application key beginning with o11_. The backend checks revocation, expiration where applicable, and the associated card policy. Treat that policy as the authority, rather than granting access based on anything a model says about its role.
Separate four kinds of authority
Tool access, account access, action permission, and spending authority are separate decisions. An application can need one without needing all the others.
| Authority | Example question | Useful default |
|---|---|---|
| Tool scope | May the research agent use this extraction operation? | Specific allowed operations |
| Account scope | May it use this workspace’s connected provider account? | Explicit allowed connections |
| Action permission | May it publish, send, create, or delete? | Read-oriented work first |
| Spending authority | How much wallet-funded work may it authorize? | Bounded amounts and lifecycle permissions |
For example, a research agent can be allowed to search public pages and create a local brief without permission to send email. A media agent may generate an asset without permission to purchase a recurring service. These distinctions should be enforced when work is admitted.
Avoid an all-purpose key shared by development, experiments, scheduled work, and production. When a problem occurs, narrow credentials make it easier to identify the affected application, limit exposure, and rotate access without interrupting everything else.
Discover without executing a supplier call
o11’s HTTP API uses POST /v1/{operation} with a JSON body. The following Bun script shows a discovery request. It requires your configured HTTPS origin and an application key in environment variables. It does not invoke a paid supplier operation.
const origin = process.env.O11_TOOLS_URL;
const apiKey = process.env.O11_API_KEY;
if (!origin || !apiKey) throw new Error("Missing o11 configuration");
const base = new URL(origin);
if (base.protocol !== "https:") throw new Error("Use an HTTPS origin");
const response = await fetch(new URL("/v1/discover", base), {
method: "POST",
redirect: "error",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query: "search" }),
});
const payload: unknown = await response.json();
if (!response.ok) throw new Error(`Discovery failed: ${response.status}`);
console.log(payload); Save this as discover-tools.ts and run bun discover-tools.ts in a configured environment. Bun supports the Fetch API used here. Keep the response typed as unknown until your application validates the fields it consumes. Bun Fetch documentation.
Discovery is a candidate list, not execution approval. A candidate may still require account setup or a pricing configuration. Inspect the selected identifier before constructing input.
Construct an explicit invocation
The invocation envelope keeps several decisions visible:
{
"toolId": "EXACT_ID_FROM_INSPECTION",
"idempotencyKey": "STABLE_KEY_FOR_ONE_APPROVED_INTENT",
"input": {
"pathParams": {},
"queryParams": {},
"body": {},
"headers": {}
},
"credentialMode": "platform",
"maxCostMicros": "1000000",
"allowWrite": false,
"acceptRecurring": false
} This is an envelope illustration, not a ready-to-execute supplier request. Replace the input according to the inspected operation. The one-dollar maximum is an illustrative authorization ceiling, not a provider quote or recommended budget.
For customer-account mode, include an allowed connectionId when required. Keep the account choice in trusted application configuration. Do not let a model discover an arbitrary connection identifier and silently change which account pays for or owns the operation.
An idempotency key belongs to one request intent. Persist it before dispatch and retain it with the submitted inputs. A request with changed inputs is a different intent and requires a new review. Reusing a key should not become a way to change authorized work after approval.
One key does not mean one bill
A platform can present one access credential while supporting different funding paths. In o11, customer-account calls do not debit wallet credits, but supplier usage can still be charged to the connected account. Wallet-funded calls use configured platform supplier access and require their own rate and funding readiness.
The application should retain the account mode alongside the receipt. Otherwise a dashboard can misleadingly display a zero wallet charge as zero operating cost. For a mixed workflow, combine platform usage records with direct-account billing evidence before making cost claims.
A ceiling is also different from an estimate. maxCostMicros bounds the submitted wallet-funded request. A quote estimates eligible work. A receipt’s billed amount records the settled outcome when known. Keep those concepts separate in user-facing reporting.
If the purpose is to reduce unused subscriptions, compare usage patterns rather than API-key counts. A frequently used provider may justify a direct agreement; an occasional capability may fit shared access. Our break-even worksheet shows how to make that decision with your actual rates.
Recover with the same authority
After an invocation is accepted, save its identifier before continuing the workflow. Use get_invocation to retrieve existing work. An agent should not need broader access simply because a job takes longer than one request.
The receipt can show queued, executing, waiting, succeeded, failed, cancelled, or unknown work, as well as an approval state. Build application logic around the actual state rather than treating every successful transport response as a completed tool result.
If the caller loses access, an administrator may need to investigate the existing invocation through an authorized management path. Issuing a new key does not erase supplier work. Revocation should block unauthorized future access while preserving historical records and an operator recovery route.
For uncertain outcomes, retain the invocation and evidence. Do not generate a new purchase just to obtain a clearer response. The tool failure guide explains why request retries and replacement work need different treatment.
A rotation and isolation exercise
Before using a shared key in a real product, conduct a controlled exercise in your own environment. Create a narrowly scoped development credential. Confirm discovery returns only relevant operations. Check that unrelated connections and resource identifiers remain inaccessible.
Then rotate that credential and confirm the old one is rejected. Verify the replacement can perform the intended discovery and status operations without gaining additional rights. Review logs to ensure neither key nor supplier secrets appear in model-visible results.
Record the expected behavior before running the exercise. A failed authorization check is a meaningful result, not a reason to weaken the policy until the demo works. Resolve configuration through the administrative path.
The same approach applies across projects. Share the transport adapter and schema validation, while issuing separate execution access and configuration for each application. The reusable tool layer demonstrates that separation.
What to build first
Start with discovery, inspection, and existing-result retrieval. Those establish the basic interface without purchasing supplier work. Add invocation only after account readiness, input shape, and spending authority have been reviewed.
The public HTTP contract makes this possible without installing a private package. o11’s repository SDK currently remains a workspace package; the REST example above avoids implying a published dependency. Live paid supplier availability must still be confirmed for your environment.
For an existing assistant, follow Claude Code setup or Cursor setup. For a custom application, keep one small server-side adapter and expose only the domain operations your agent actually needs.





