Agent setup examples

Create a chat agent key and configure OpenAI-compatible agents, Hermes, the OpenAI SDK, or cURL.

Updated

Use a llmbase_chat_... key with the agent API base URL when an external agent should consume your Pro Chat/Agent subscription budget.

Create a chat agent key

  1. Open Dashboard -> Agent Access.
  2. In Chat agent keys, create a new key.
  3. Copy the key immediately. It is only shown once.

Revoking a key disables it immediately. If a bounded-lifetime key is shown as expired, create a replacement instead of continuing to use the old token.

Configure an OpenAI-compatible agent

Use these settings in any agent that supports a custom OpenAI-compatible API:

SettingValue
Base URLhttps://llmbase.ai/api/v1/agents
API keyYour llmbase_chat_... chat agent key
Models endpointGET /models
Chat endpointPOST /chat/completions

Chat completions accept a JSON body of up to 8 MiB (8,388,608 bytes). A larger body returns HTTP 413 with code request_body_too_large and error.type request_too_large. See Usage and rate limits for how that cap differs from the included budget and from rate limits.

Example OpenCode configuration

Use a custom OpenAI-compatible provider. Set limit.context to the model’s context window so OpenCode compacts from token usage before a request reaches the 8 MiB (8,388,608-byte) body limit. DeepSeek V4.1 Flash (deepseek/deepseek-v4.1-flash) has a 1,048,576-token context window, so set limit.context to 1048576. Set limit.output to 384000, the model’s maximum output length. compaction.auto turns on automatic compaction, including one compact-and-retry when this API returns HTTP 413 with error.type request_too_large.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "llmbase": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LLMBase",
      "options": {
        "baseURL": "https://llmbase.ai/api/v1/agents",
        "apiKey": "{env:LLMBASE_CHAT_AGENT_KEY}"
      },
      "models": {
        "deepseek/deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash",
          "limit": {
            "context": 1048576,
            "output": 384000
          }
        }
      }
    }
  },
  "compaction": {
    "auto": true
  }
}

Run /connect, choose Other, and use the provider id llmbase. The key can also live in LLMBASE_CHAT_AGENT_KEY, as in the snippet.

OpenCode V1 only: also set compaction.prune to true. That removes old tool outputs. V2 summarizes older conversation and does not use prune.

{
  "compaction": {
    "auto": true,
    "prune": true
  }
}

Example Hermes configuration

Hermes should be configured as a named custom provider. A bare custom provider with only OPENAI_API_KEY may not send the key to non-OpenAI hosts. Load the current agent model list first, then choose a returned model with the tool, context, and cost profile your agent loop needs.

model:
  provider: llmbase
  model: <model-id-from-agent-models>
  base_url: https://llmbase.ai/api/v1/agents
  api_key: llmbase_chat_...
  api_mode: chat_completions

custom_providers:
  - name: llmbase
    base_url: https://llmbase.ai/api/v1/agents
    api_key: llmbase_chat_...
    api_mode: chat_completions
    model: <model-id-from-agent-models>

Hermes uses reasoning_effort: medium by default. LLMBase accepts that default for reasoning-capable models. When a model publishes high but no native medium tier, the request uses high automatically; no Hermes override is required. Explicit unsupported values still return a validation error.

Example with the OpenAI SDK

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://llmbase.ai/api/v1/agents",
  apiKey: process.env.LLMBASE_CHAT_AGENT_KEY,
});

const models = await client.models.list();
const model = models.data[0]?.id;

const response = await client.chat.completions.create({
  model,
  messages: [
    { role: "user", content: "Draft a short product update." },
  ],
});

console.log(response.choices[0]?.message?.content);

Example cURL request

curl https://llmbase.ai/api/v1/agents/chat/completions \
  -H "Authorization: Bearer $LLMBASE_CHAT_AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<model-id-from-agent-models>",
    "messages": [
      { "role": "user", "content": "Summarize this repo issue." }
    ]
  }'