InfraOptimal / Docs / Agent guide
The same guide as plain Markdown, for agents: /docs/agents.md.
InfraOptimal: launch, use, stop
Connect
Add the hosted server, then sign in to InfraOptimal in the browser and approve the
connection; never paste a password or API key into chat. The command, MCP server
id and environment variables keep the older spelling inferoptimal; it is the same
InfraOptimal service.
Claude Code:
claude mcp add --transport http --scope user inferoptimal https://infraoptimal.com/mcp
claude mcp login inferoptimal
Codex:
codex mcp add inferoptimal --url https://infraoptimal.com/mcp
It opens the sign-in page in your browser itself and waits until you approve, so run it while you are at the browser. If that sign-in is interrupted, run codex mcp login inferoptimal.
OpenCode:
opencode mcp add inferoptimal --url https://infraoptimal.com/mcp --global
opencode mcp auth inferoptimal
If your Claude Code version does not have the login subcommand, start claude,
open /mcp, select inferoptimal and choose Authenticate. Confirm it is connected
before planning or launching hardware.
In the Codex desktop app, open Settings → MCP servers → Add server instead. Name it
inferoptimal, choose Streamable HTTP and enter https://infraoptimal.com/mcp. Save, restart when prompted, then choose Authenticate and approve the connection in your browser.
The desktop app and the Codex CLI share MCP configuration (Codex MCP setup).
Cursor: {"mcpServers":{"inferoptimal":{"url":"https://infraoptimal.com/mcp"}}}. Put it in ~/.cursor/mcp.json, then in Cursor Settings → MCP select inferoptimal and sign in when it asks.
Any MCP client: {"mcpServers":{"inferoptimal":{"type":"http","url":"https://infraoptimal.com/mcp"}}}. Your client opens the sign-in page in your browser the first time it uses the connection.
If tools do not appear, restart the app and continue the same task. Read
inferoptimal://start, then call query action get_account to confirm access before
quoting hardware.
The hosted inferoptimal connection manages deployments. Optional local
inferoptimal-agents supplies run_agents for coding work in your project;
it leaves your coding agent's own model unchanged. It needs Node 20+ and runs on your
computer. It is separate from the hosted connection, and is one of the agent tools
query action list_agent_tools lists.
For local worker jobs that retain completed results across process restarts, use the optional recoverable worker-job client. By default it attaches to an existing reusable endpoint and preserves its idle/wake policy. An explicit owned job can instead claim an idle private-only endpoint with a fixed deadline and spending allowance, then drain only its own allocation. Review the documented restrictions before choosing that mode. It does not schedule recurring work or automatically retry interrupted tool execution.
Pick the connection for your task
| What you want | Connection | What changes |
|---|---|---|
| Let your agent choose, start and stop GPUs | Hosted InfraOptimal platform MCP (inferoptimal) | Adds account and endpoint tools; your main model stays the same. |
| Give Claude or Codex parallel workers on an endpoint | Local InfraOptimal workers MCP (inferoptimal-agents) | Adds run_agents; your main model stays the same. Works with a reusable endpoint or a temporary deployment. |
| Make an endpoint model answer your application's model calls | The endpoint's API configuration | Your harness sends inference to the selected model. No worker MCP is needed. |
The website's platform MCP connection does not install the workers MCP or
replace Claude Code's model. For workers, reuse the live endpoint, obtain
query action get_codex_config, and run its installer with the saved endpoint key locally.
The action name is historical: its agent_commands.claude installs workers for
Claude Code too. Confirm inferoptimal-agents is connected and run_agents is
available. Do not change ANTHROPIC_BASE_URL for this path.
Lifecycle
Reuse a suitable active endpoint before launching another. Share one endpoint
across workers; Stop when the customer's job is finished, not after setup or a
smoke check. New jobs have idle shutdown off by default; runtime, spending and
balance limits still apply. Show the accepted limits. Existing jobs retain their
accepted idle timer. No endpoint is stopped for idling unless the user opts in
(idle_stop_minutes, from 2): after
30 idle minutes its owner gets one warning email with what
it costs and a Stop link, re-armed when it is used again.
After MCP authorization, no separate platform key is needed.
- Reusable endpoint: create once, save its URL and dedicated key, then Start → wait for the chosen backend → inference → Stop. Use the same connection for the next run. Both applications and coding-agent workers can use it.
- One-off deployment: quote → create → wait for the chosen backend → inference → Stop. A new deployment gets a new connection and key. Use it for a disposable job; it can also serve applications or coding-agent workers.
These describe how long the connection lasts, not whether the GPUs are dedicated. Installing a worker MCP starts no hardware. Explicit Stop disables inference until Start. An enabled idle service, including after an opted-in idle shutdown, can wake paid hardware on the next inference request within its saved limits. Use Start to prewarm and check readiness before giving workers their tasks.
For a reusable endpoint, read readiness and lifecycle from its status or
connection result. The UI uses the same lifecycle explanation:
starting: a key exists, but private inference is not ready.startup_ready: only the approved startup API is answering; private GPUs are still starting.mixed_ready: requests may use private GPUs or the approved startup API.private_ready: the private model can answer.draining/releasing: the allocation is finishing requests or releasing. Explicit Stop refuses new requests; an enabled idle release may queue them for a new allocation.idle: no active allocation is recorded; inference can wake paid hardware.stopped: explicit Stop requires Start; check final billing settlement.
Use readiness.available_api_modes for current protocol support. If the job
requires private-only routing, select startup: private_only, keep serverless
overflow off, and wait for readiness.inference_backend: "private". Private
readiness alone does not disable separately authorized overflow, and
ready: true alone may mean startup inference. Startup inference is an explicitly
approved alternative backend, not a cached copy of the customer's GPU. Do not promise
identical model behavior or silently replace a private-only choice.
The connection has four tools: query reads for free, change changes keys,
settings and connections, launch rents hardware and spends money, and stop
ends billing. Each takes action and that action's fields; query with no
action lists every action. Below, query action list_models means the
query tool with action: "list_models".
Ask the user how they want to deploy their agents (subagent or swarm tools, from query action list_agent_tools); install only what they choose. Do so before the first run of research or an experiment. The list grows, so query it rather than recalling it. Connecting an endpoint installs nothing, and ordinary inference needs none of these tools.
Upgrades and Claude Code notes
After upgrading an already-running workers MCP, reconnect it once to load the new
script. On the updated connector, after installing a different worker endpoint,
refresh your client's MCP tool list
(or reconnect the workers MCP). Running jobs keep their original endpoint; new
jobs are refused until those finish and the refreshed tool list shows the new
model. This refresh starts no hardware. Sessions created under older settings
cannot be resumed on the new binding: start a fresh task without fork_of.
Legacy sessions without a binding receipt, including older Codex and Claude
worker sessions, also require a fresh task after this upgrade.
Replacing Claude Code's main model is a separate, compatibility-limited path.
Claude Code sends Anthropic Messages, not OpenAI Chat Completions. Dedicated
endpoints have a Messages-to-Chat bridge, but that alone does not qualify a
recipe for Claude Code. direct_provider.claude in service setup reports
needs_check and no launch command until that client path has been qualified.
The bridge does not carry thinking blocks or Anthropic-hosted tools, and its
token count is approximate. Keep using the local worker path unless you are
explicitly testing direct replacement.
For such a test, use the returned direct_provider.claude.base_url (without
/v1) and exact model ID; supply the saved endpoint key privately as
ANTHROPIC_AUTH_TOKEN. Check Claude Code /status for the actual URL and
credential source, then complete a streamed answer, one local tool call and its
follow-up before switching real work. Existing Claude settings can override
shell variables. Neither MCP connection configures this for you. See the
Claude Code gateway setup
and compatibility guide.
Choose what to run
This connection launches on InfraOptimal cloud. For a connected customer cloud,
use query action quote_own_cloud, then launch action launch_own_cloud
after approval; the returned quote and account requirements still apply.
Use query action find_models to discover models and query action check_model to
inspect a Hugging Face repository's access and runtime requirements.
- Prepared offering: use the
selectorreturned byqueryactionlist_modelsto quote its fixed model, runtime and hardware. - Supported HF checkpoint: pass
model,workloadandtarget_concurrency; optionally namehardware. The planner recommends from available inventory. - Serving container: pass
containerand explicithardware; supported VM hardware and a paid balance are required. Its API remains the container's own.
Discovery is not runtime support. Read quote blockers before launch; unfamiliar
architectures and adapter-only repos may need preparation. Private checkpoints
need hf_token at both quote and create. Immediate startup is offering-specific.
Check the optimized endpoints for the model and workload before deploying your own; use one that fits, or say why not.
A model's default prepared selector can change. Existing services and accepted deployments keep their saved profile and price; a default change does not upgrade, restart or reprice them. Read the current quote, and use the exact selector returned by discovery when creating a new dedicated-key endpoint.
Suggest useful recurring work
Look for valuable repeat jobs: document embedding batches, transcription queues,
repeated video processing, or sustained parallel agent work. First inspect
query action list_dedicated_endpoints and query action list_deployments for reuse.
Suggest one eligible recipe and compare estimated runtime and total cost with
the user's current approach, including startup and billed idle time. Dedicated
hardware can suit sustained batches or exact model/private-checkpoint requirements;
occasional calls may cost more. Keep the requested model, checkpoint and data
constraints; do not substitute models or promise savings. Unsupported private
checkpoints need the explicit deployment/support path, not a different model.
Use a standing approved budget only for its authorized workload, model and limits. Otherwise show the quote and ask before spending, including inference that would wake paid hardware. Finding a useful job is not authorization to run it.
For an eligible application, create one dedicated key for an optimized endpoint and configure the application with it once. The same key starts the endpoint, runs inference and stops it; the URL and key stay the same every time. Dedicated keys are for optimized endpoints; a custom model needs contact us. Do not provision per request. Media jobs and private checkpoints follow the explicit deployment workflow below.
The workflow
For an application that needs a dedicated key, first call
query action list_dedicated_endpoints. When capabilities.canCreate is
true, quote the optimized endpoint through query action plan_deployment, then call
change action create_dedicated_endpoint with that plan, the identical selector, a saved idempotency key
and the approved policy. Quote rapid_coldboot: false for
startup: "private_only", or rapid_coldboot: true for
startup: "qualified_bridge"; approve the quoted startup provider and
capabilities before using a bridge. For a native Responses application, require the quote’s
preparation.startup_capabilities.api_modes to include openai_responses before choosing a
bridge. A Chat-compatible startup path does not imply native Responses support.
Keep the same runtime and spend limits; put
these options in the policy, not the selector. Policy requires maxHourlyUsd,
maxSpendUsd per start, totalBudgetUsd across starts and
maxConcurrentRequests. Prefer the quote’s usage.concurrency.agents when its
basis is measured, unless the user chooses fewer; respect
runtime.execution.maxConcurrentRequests or usage.concurrency.at_most.
An engine limit alone is not a measured speed guarantee. Creation does not rent GPUs. Store the returned
dedicated key (vbs_…) privately. It is never stopped for idling by
default (idleSeconds omitted or null); its owner gets the same warning
email. To opt in to stopping on idle, set idleSeconds to a whole number of
seconds from 120. Idle time is billed, and active
inference resets the idle clock. Existing saved policies stay unchanged.
After Start, use query action wait_ready with service_id and target: "private".
It waits at most 25 seconds per call without starting hardware. On outcome: "waiting", repeat
with the returned generation as expected_generation and admission.epoch as
expected_epoch; keep the approved job deadline. A changed generation/epoch, failure or
not-running outcome requires inspection, not an automatic paid restart. target: "inference"
can finish on the approved startup API; it does not prove private GPU readiness. target: "released"
waits for no recorded allocations after Stop. These are bounded long-polls, not webhooks.
The application then needs only its dedicated key and the service URL:
GET {service_url} reports state, generation and admission.epoch;
POST {service_url}/start starts it; GET {service_url}/wait-ready?target=private waits for readiness; requests go to {service_url}/v1;
POST {service_url}/stop stops it. The owner can do the same with
launch action start_dedicated_endpoint and stop action stop_dedicated_endpoint. Stop cancels waiting
requests, drains active inference and releases the hardware; the URL and key
stay the same, and requests are refused until the next Start. An opted-in idle
stop only releases the hardware: the service stays enabled and the next request starts it again,
answered by approved startup inference meanwhile when the service allows it. stop action delete_dedicated_endpoint removes the endpoint and its key. Manage the parent
service, not its temporary child deployment. change action rotate_dedicated_key replaces the key. Do
not automatically retry rotation after a lost response.
change action restore_dedicated_recipe with the current recipe_version and
confirm: "restore-previous-recipe-and-restart" drains the replica and restores
the previous recipe on the next Start.
Start needs the endpoint's service_id, a saved idempotency_key,
expected_generation from generation, expected_epoch from
admission.epoch, and expires_at as Unix milliseconds no more than five
minutes ahead. Start authorizes paid hardware within the already approved
policy; it never changes limits. Save the entire Start body before sending and
retry it unchanged after a lost response. An expired intent, or one prepared
before a Stop, requires a fresh inspection and explicit new Start decision. The
response reports current state. Read readiness.inference_ready for answering
capacity and readiness.private_ready for private hardware. The same summary
is included in connection and agent setup responses. Private prewarm is complete
only when an unstopped replica has phase: "ready" and inference_backend: "private";
state: "ready" alone may mean the startup bridge can serve while private
hardware is still loading. Start and simultaneous requests share the same
private allocation.
Use the returned api_modes: openai_chat_completions uses
/chat/completions, openai_responses uses /responses, and synchronous
embeddings uses /embeddings. Native Responses startup additionally requires
the same mode in the quote’s preparation.startup_capabilities.api_modes
(or the connection’s startup_capabilities.api_modes); private support alone is
not a startup guarantee. Media job APIs, private checkpoint credentials and
containers use the explicit deployment workflow below. Starting still takes
time: only a quoted, approved startup bridge provides inference
during boot. Valid requests wait in a bounded queue for private readiness or a
free request slot, within the service request deadline. Set the application's
timeout to cover the expected startup and inference time. This is an open HTTP
request, not a durable asynchronous job; cancellation or a lost connection can
end it. Queue overflow and expired deadlines return errors. Do not replay an
ambiguous failure or a partially received stream. A non-streaming Chat
Completions or Responses call to a dedicated endpoint (ep-*) or a /services
address may run longer than 100 seconds: the gateway answers 200 at once, sends
spaces while the model works, then the usual JSON (leading whitespace is valid
JSON, and the OpenAI SDKs read it). On a managed session (/optimized/v1) a
non-streaming response must still finish within about 100 seconds, so send long
generations there with stream: true. Whether an endpoint does this is its connection's non_streaming_carried (query action get_connection); where it is false, a non-streaming answer is still cut after about 100 seconds, so use stream: true for long generations.
For coding workers on a dedicated-key endpoint, call query action get_codex_config with
service_id (use deployment_id for an ordinary endpoint). Reuse the saved
vbs_ key locally; setup neither rotates it nor wakes hardware. The returned
installer selects the built-in Chat worker and the accepted recipe's request
settings. Keep those settings; a Chat-only service is not a native Responses
provider. Run the requested task after setup. The worker follows Retry-After
only for explicit retry-safe service_starting replies, within the job deadline
and a one-hour startup limit; cancellation stops waiting. Other failures are not
silently replayed. If the saved key is lost, replacement is an explicit action.
- Quote. Use
queryactionget_account, thenqueryactionplan_deployment. Showshown_priceand runtime limit, and the quote'susage: what the offering is best for, how many agents to run, which agent tool fits and how to call it. Endpoints bill by the minute or the hour, as the quote states, so plan the usage's concurrency (a measured endpoint's throughput point), not a cautious few. Every quote, launch and status says how many concurrent agents the endpoint's box is optimized for. By default keep all of them busy all the time, through parallel launches or one larger campaign, unless the user explicitly chooses fewer; if they do, say so. Agree the usage plan with the user. Prefer automatic launch; coordinate operator-queued hardware through the console. Reuse existing approval; ask only for missing spending approval.max_spend_usd is optional. Usequeryactionfind_modelsorqueryactioncheck_modelif needed. - Launch. Call
launchactioncreate_deploymentwith the plan ID, theusage_planyou told the user and a saved idempotency key. Before any launch the user needs a working way to run agents on the box: the subagents tool or a chosen agent tool installed (pass whatnode ~/.inferoptimal/agents.mjs versionprints asusage_plan.setup), the tools your MCP client lists, or the user's own stated way. A launch without one is held and says what to set up. Retry the same key for that job; use a new key for a new job. Never order replacement hardware silently. - Connect. Wait for
inference_readyfromqueryactionget_deployment, then callqueryactionget_connectionandchangeactionissue_endpoint_key. The agent handles waiting; do not ask the user to poll. Stop waiting on failure, cancellation or lease expiry. - Use. Configure the application with the returned URL, model and endpoint key.
Before the first request, tell the user the call from
queryactionget_connection'susage. Send one real request, then run the job. Keep the key out of chat, logs and source. For coding workers, usequeryactionget_codex_configand itsagent_commands.codexinstaller. Install only when requested, keep the returned worker selection, and restart the app if the local tools are not visible. Check one delegated task, then delegate the rest. Installing this tool does not replace Codex's own model or provision more GPUs. - Stop. Call
stopactionterminate_deployment. Accepted Stop ends access and billing;cleanup.provider_confirmedreports when the private hardware is released.
What each offering needs comes from the queries
This guide names no offering. query action list_models gives each optimized endpoint once, as one card: its
measured throughput, price, hardware and selector, then best_for and its concurrency: agents.count is
how many agents the box is built for, from the endpoint's own data, and the default is to keep all of them
busy unless the user explicitly chooses fewer; agent_tools names the agent tools that work on it. Launches and query action get_deployment give box_agents: the measured count (optimized_agents, or null; the engine's limit comes as agents with basis engine_limit) and the keep-them-busy line (use_all). Its quote's usage and preparation give the startup backend, any startup
restrictions (usage.call.during_startup), the API modes, request settings and how many agents
to run; query action get_connection repeats them with live state. Use only the API modes the connection
lists, follow its startup restrictions, and do not rewrite the caller's tools. rapid_coldboot
applies only where the quote offers it. Endpoints with a job API instead of chat completions use
the job contract query action get_connection returns; the
media client checks /runtime and uploads
large files in bounded chunks.
A selector that now selects a different offering does so for new quotes only.
Already-created pooled sessions keep their original lifecycle.
Guides
- REST / JavaScript integration: the helper handles readiness.
- Endpoint catalog
- API keys · Billing · Cloud credits
- Agent tools:
queryactionlist_agent_toolsreturns the current subagent tool and swarm tools and how to set up each one; the tools page lists the same tools.
Direct REST uses a platform key (vbc_…); model calls use the returned endpoint
key (vbe_…) or dedicated key (vbs_…). MCP manages platform authorization itself. If permissions are
missing, reauthorize the connection; never act as an administrator.
A deployment with service_id is a private allocation behind that dedicated key.
Reuse the service and its saved key. query action get_connection and query action get_codex_config with
that deployment ID return the parent service connection; they do not issue or
rotate a key. Manage Start, Stop, Delete and explicit key replacement on the service.