Agent.Space Blog

How to Use the Agent.Space Developer API

Create an Agent.Space API key, choose a local Agent or server SDK, discover compatible models, and verify requests against your plan allowance or credits.

The Agent.Space Developer API connects a supported local Agent or your own server integration to models available through your Agent.Space account. Start with a dedicated key, choose a compatible model and client configuration, then verify one small request in Request history before expanding usage. You do not need to write an SDK integration just to connect an existing Codex, Claude Code, or OpenCode client. If the goal is to consolidate several provider keys behind one endpoint, use the one API key, multiple AI models migration guide before changing production traffic.

Do not copy a model name from an old article or put a real key in browser code. The live /v1/models response is the source of truth for model IDs and the endpoints each model can be called on, while the Developer API page is the current product entry point.

Last verified: October 10, 2026. This update checks Agent.Space's public API page and current client-template, model-discovery, and Request history implementation. It does not include an authenticated production call or a measured customer result. Models, protocols and funding rules can change; check the live setup panel before using a configuration.

What the Developer API does

The API is a model-access layer for server integrations. Its current integration shapes include:

  • OpenAI Responses and OpenAI Chat Completions through an OpenAI-compatible server SDK configuration.
  • Anthropic Messages through an Anthropic-compatible server SDK configuration.

Every text model returned by discovery can be called through all three: Agent.Space serves a model's native protocol directly and translates requests sent through the others. These are still connection shapes, not a promise that every provider feature behaves identically; check that the model supports the capabilities your client requires.

Keep plan allowance and credits distinct. Agent.Space's current API overview describes plan-covered models using allowance and other available models using credits. Check the selected model's current funding and continuation rules in the product: neither a displayed model name nor a successful connection proves that a request will stay within a plan allowance. Agent.Space credits are not an OpenAI or Anthropic API balance.

Choose a local Agent setup or a server SDK

What you want to doSetup pathWhat you still own
Use Codex, Claude Code, or OpenCode on your computerOpen the Developer API setup guide, select the client and an available model, then copy its generated configurationLocal files, client installation, local permissions and configuration secrets
Build a backend or private automationUse model discovery and the protocol-specific SDK examples belowApplication code, server secrets, error handling and spend monitoring
Keep a project in a hosted WorkspaceUse the Agent.Space Workspace rather than treating an API key as a hosted environmentProject access decisions and review of Agent actions

For a local client, use its own tab in the live setup guide. The Codex, Claude Code and OpenCode configurations are not interchangeable. Back up the existing configuration and preserve unrelated settings when applying the generated values. Never commit a configuration containing the full key.

An API connection supplies model access; it does not upload your repository or create a shared project by itself. The rest of this article covers the server integration path and the request checks useful for either route.

Before you integrate

Prepare four things:

  1. An Agent.Space account eligible for external API access, with the required plan allowance or credits. Check the live panel rather than assuming a signup bonus is sufficient.
  2. An API key dedicated to this integration or environment.
  3. The production endpoint: https://api.agent.space.
  4. A model ID returned by the live model-discovery endpoint.

Use separate keys for local development, production, and automation when independent rotation would reduce downtime. A key name is an organizational label; the secret value is what authorizes spending.

Step 1: Create and protect an API key

Open the Developer API panel and create a key with a name that explains its purpose, such as Production backend. Copy the full value into the intended secret store.

Apply normal credential controls:

  • keep the key in a server-side environment variable or approved secret manager;
  • never commit it to a repository or paste it into a screenshot, issue, browser bundle, or prompt;
  • give each environment its own key when separate revocation matters;
  • rotate or revoke a key immediately if exposure is possible.

A local shell can use a placeholder like this:

sh
export AGENT_SPACE_API_KEY="<paste-full-api-key>"

This is a placeholder, not a recommendation to paste a live key into saved shell history. Load real credentials through your secret manager or another protected local mechanism, and keep them out of diagnostic output.

Step 2: Discover available models

Ask the API which models the current key can access:

sh
curl "https://api.agent.space/v1/models" \  -H "Authorization: Bearer $AGENT_SPACE_API_KEY"

Choose the exact returned id. Its endpoints list shows where the model can be called: text models list /v1/chat/completions, /v1/responses, and /v1/messages. The protocols field names the model's native protocol; requests through the other endpoints are translated.

sh
export AGENT_SPACE_MODEL="<model-id>"

Repeat discovery when you intentionally change models or a previously valid ID disappears. A static model list in a Blog post will age; the live response will not.

Step 3: Connect through the client-native protocol

Use the base URL expected by the client rather than treating the two SDK configurations as interchangeable.

Client shapeProtocolBase URL
OpenAI Node.js SDKOpenAI Responseshttps://api.agent.space/v1
OpenAI-compatible Chat Completions clientOpenAI Chat Completionshttps://api.agent.space/v1
Anthropic Node.js SDKAnthropic Messageshttps://api.agent.space

OpenAI Responses example

Install openai in your server project and set both environment variables before running this example. It sends a minimal text prompt, not repository files.

ts
import OpenAI from "openai"
const client = new OpenAI({  apiKey: process.env.AGENT_SPACE_API_KEY,  baseURL: "https://api.agent.space/v1",  maxRetries: 0,})
const response = await client.responses.create({  model: process.env.AGENT_SPACE_MODEL,  input: "Reply with: connection ok.",})
console.log(response.output_text)

Anthropic Messages example

Install @anthropic-ai/sdk. The model from the previous example works here too: any text model can be called through Messages, and Agent.Space translates the request when the model's native protocol is different.

ts
import Anthropic from "@anthropic-ai/sdk"
const client = new Anthropic({  apiKey: process.env.AGENT_SPACE_API_KEY,  baseURL: "https://api.agent.space",  maxRetries: 0,})
const message = await client.messages.create({  model: process.env.AGENT_SPACE_MODEL,  max_tokens: 1024,  messages: [{ role: "user", content: "Reply with: connection ok." }],})
console.log(message.content)

These examples document the configuration shape. They are not a benchmark, a customer result, or proof of feature parity across models.

Step 4: Verify one small request before real traffic

After the first request, inspect Request history and confirm:

  • the expected key was used;
  • the model ID and protocol match the configuration;
  • the request reached Agent.Space and completed as expected;
  • the recorded funding source is the one you intended.

Use this acceptance checklist to avoid mistaking one successful connection for a finished integration:

EvidenceWhat it establishesWhat it does not establish
Discovery returns a compatible model IDYou have an ID and protocol to configureA generated answer, sufficient funding for every later call, or feature parity
One small request returns usable outputThat request worked with the chosen setupA coding benchmark or permission to scale traffic without monitoring
The matching history entry has a completed status and expected fundingYou can reconcile the request with the account's usage recordThat every future request will use the same funding path

Filter Request history by the key and narrow it by model or protocol. Keep the request ID, timestamp and any error code when asking for help, but not the key. A row marked pending or requiring reconciliation is not a confirmed final charge. A successful row covered by the plan still consumes allowance; it is not evidence of unlimited free API use.

For a cost review, include every call in the accepted task—not only this first request. The coding Agent API cost calculation guide shows how to separate uncached input, cache activity, output, tools, and retries without inventing a universal task price.

This guide did not send a production request with a reader's key. Its examples mirror the current setup shown by Agent.Space; your own small request and Request history are the evidence that the selected key, model, protocol, and funding path work for your account.

For an application upgrade, the Opus 5.5 API migration test plan covers response blocks, tool loops, and safe retries.

Rotate, revoke, and troubleshoot in a fixed order

Rotation invalidates the old secret, so update the dependent service as part of the cutover. Revocation is appropriate when an integration is retired or a key may be exposed. Renaming helps organization but does not change the secret.

When a request fails, check one layer at a time:

  1. Is the complete active key available to this server process?
  2. Does /v1/models return the configured model ID?
  3. Does that model's endpoints list include the path the client calls?
  4. Is the base URL correct for the SDK shape?
  5. Is the relevant funding path available for the selected model?
  6. Does Request history show that the request reached Agent.Space?

This order separates authentication, model availability, endpoint compatibility, routing, and funding. Changing all five at once makes the failure harder to diagnose.

Use the HTTP response and Request history together rather than guessing from one symptom:

What you observeCheck firstSafe next action
No HTTP responseDNS, TLS, outbound network policy, and the configured hostConfirm the process can reach https://api.agent.space, then retry one small request
401 or 403Whether the complete key reached this server process, whether it was revoked, and which environment or account owns itTest the same key against /v1/models; rotate only if exposure or revocation is plausible
404 from an SDK requestThe protocol-specific base URL and the path the SDK appendedUse https://api.agent.space/v1 for the OpenAI SDK shape and https://api.agent.space for the Anthropic SDK shape
Model missing or rejectedThe current /v1/models result and that model's endpoints listSelect an ID returned for this key instead of copying an old static model name
429, capacity, or funding-related responseThe returned error body, live account limits, selected model, and its expected funding sourceStop automatic retry loops; resolve the named limit or funding condition before sending more traffic
No matching Request history rowEndpoint, network, and client-side authentication configurationTreat this as evidence that the request may not have reached Agent.Space; fix the earliest failing layer first
A failed Request history row existsRecorded model, protocol, funding source, HTTP status, and error codeKeep those fields together when diagnosing or contacting support; do not change several variables at once

An HTTP status is a clue, not a complete diagnosis. Preserve the response body and request identifier when one is returned, and never paste the API key itself into logs, screenshots, or support messages.

When the connection works but traffic fails, distinguish API rate limits and bounded retries from latency in the model, client, or tools. Keep credential changes separate: the API-key security checklist covers rotation and exposure response.

Start with a small verified integration

The safe first integration is deliberately narrow: one named key, one model selected from live discovery, one client-native protocol, and one small verification request. Expand only after Request history matches the configuration you intended.

Review current Agent.Space plans and model pricing, then create your Agent.Space account. Once the account has the funding path you want, return to the Developer API page to create the integration key.