KosmoKrator

ai

Anthropic CLI for AI Agents

Use the Anthropic CLI from KosmoKrator to call Anthropic tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write API key auth

Anthropic CLI Setup

Anthropic can be configured headlessly with `kosmokrator integrations:configure anthropic`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure anthropic --set api_key="$ANTHROPIC_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor anthropic --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key ANTHROPIC_API_KEY Secret secret yes API Key
url ANTHROPIC_URL URL url no API Base URL

Call Anthropic Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call anthropic.anthropic_list_messages '{
  "model": "example_model",
  "limit": 1,
  "before_id": "example_before_id",
  "after_id": "example_after_id"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:anthropic anthropic_list_messages '{
  "model": "example_model",
  "limit": 1,
  "before_id": "example_before_id",
  "after_id": "example_after_id"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs anthropic --json
kosmo integrations:docs anthropic.anthropic_list_messages --json
kosmo integrations:schema anthropic.anthropic_list_messages --json
kosmo integrations:search "Anthropic" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Anthropic.

anthropic.anthropic_list_messages

Read read

List messages in the Anthropic conversation history. Returns paginated message resources with optional filtering by model, date, and ID.

Parameters
model, limit, before_id, after_id

Generic CLI call

kosmo integrations:call anthropic.anthropic_list_messages '{"model":"example_model","limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json

Provider shortcut

kosmo integrations:anthropic anthropic_list_messages '{"model":"example_model","limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json

anthropic.anthropic_create_message

Write write

Send a prompt to Claude and receive an AI-generated response. Supports multi-turn conversations, system prompts, temperature control, and configurable output length.

Parameters
model, messages, max_tokens, system, temperature, top_p, stop_sequences, stream

Generic CLI call

kosmo integrations:call anthropic.anthropic_create_message '{"model":"example_model","messages":"example_messages","max_tokens":1,"system":"example_system","temperature":1,"top_p":1,"stop_sequences":"example_stop_sequences","stream":true}' --json

Provider shortcut

kosmo integrations:anthropic anthropic_create_message '{"model":"example_model","messages":"example_messages","max_tokens":1,"system":"example_system","temperature":1,"top_p":1,"stop_sequences":"example_stop_sequences","stream":true}' --json

anthropic.anthropic_list_models

Read read

List available Anthropic AI models. Returns model identifiers, creation dates, and display names.

Parameters
limit, before_id, after_id

Generic CLI call

kosmo integrations:call anthropic.anthropic_list_models '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json

Provider shortcut

kosmo integrations:anthropic anthropic_list_models '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json

anthropic.anthropic_get_model

Read read

Get detailed information about a specific Anthropic model, including its display name, creation date, and capabilities.

Parameters
id

Generic CLI call

kosmo integrations:call anthropic.anthropic_get_model '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:anthropic anthropic_get_model '{"id":"example_id"}' --json

anthropic.anthropic_list_workspaces

Read read

List Anthropic workspaces. Returns workspace identifiers, names, and configuration details.

Parameters
limit, before_id, after_id

Generic CLI call

kosmo integrations:call anthropic.anthropic_list_workspaces '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json

Provider shortcut

kosmo integrations:anthropic anthropic_list_workspaces '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json

anthropic.anthropic_get_workspace

Read read

Get detailed information about a specific Anthropic workspace, including its name, configuration, and usage settings.

Parameters
id

Generic CLI call

kosmo integrations:call anthropic.anthropic_get_workspace '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:anthropic anthropic_get_workspace '{"id":"example_id"}' --json

anthropic.anthropic_get_current_user

Read read

Get the authenticated user's profile and account information.

Parameters
none

Generic CLI call

kosmo integrations:call anthropic.anthropic_get_current_user '{}' --json

Provider shortcut

kosmo integrations:anthropic anthropic_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

anthropic.anthropic_list_messages

List messages in the Anthropic conversation history. Returns paginated message resources with optional filtering by model, date, and ID.

Operation
Read read
Schema command
kosmo integrations:schema anthropic.anthropic_list_messages --json
ParameterTypeRequiredDescription
model string no Filter messages by model ID (e.g., "claude-sonnet-4-20250514").
limit integer no Maximum number of messages to return per page (default: 20, max: 1000).
before_id string no Message ID used for cursor-based pagination — return messages before this ID.
after_id string no Message ID used for cursor-based pagination — return messages after this ID.

anthropic.anthropic_create_message

Send a prompt to Claude and receive an AI-generated response. Supports multi-turn conversations, system prompts, temperature control, and configurable output length.

Operation
Write write
Schema command
kosmo integrations:schema anthropic.anthropic_create_message --json
ParameterTypeRequiredDescription
model string yes The model to use (e.g., "claude-sonnet-4-20250514", "claude-haiku-4-20250414").
messages array yes Array of message objects with "role" ("user" or "assistant") and "content" (string or array of content blocks).
max_tokens integer no Maximum number of tokens to generate in the response (default: 4096).
system string no System prompt to set the behavior and context for Claude.
temperature number no Controls randomness in generation (0.0–1.0). Lower values are more deterministic.
top_p number no Nucleus sampling parameter (0.0–1.0). Limits cumulative probability of tokens considered.
stop_sequences array no Array of strings that will cause the model to stop generating if encountered.
stream boolean no Whether to stream the response incrementally (default: false).

anthropic.anthropic_list_models

List available Anthropic AI models. Returns model identifiers, creation dates, and display names.

Operation
Read read
Schema command
kosmo integrations:schema anthropic.anthropic_list_models --json
ParameterTypeRequiredDescription
limit integer no Maximum number of models to return per page (default: 20, max: 1000).
before_id string no Model ID used for cursor-based pagination — return models before this ID.
after_id string no Model ID used for cursor-based pagination — return models after this ID.

anthropic.anthropic_get_model

Get detailed information about a specific Anthropic model, including its display name, creation date, and capabilities.

Operation
Read read
Schema command
kosmo integrations:schema anthropic.anthropic_get_model --json
ParameterTypeRequiredDescription
id string yes The model identifier (e.g., "claude-sonnet-4-20250514").

anthropic.anthropic_list_workspaces

List Anthropic workspaces. Returns workspace identifiers, names, and configuration details.

Operation
Read read
Schema command
kosmo integrations:schema anthropic.anthropic_list_workspaces --json
ParameterTypeRequiredDescription
limit integer no Maximum number of workspaces to return per page (default: 20, max: 1000).
before_id string no Workspace ID used for cursor-based pagination — return workspaces before this ID.
after_id string no Workspace ID used for cursor-based pagination — return workspaces after this ID.

anthropic.anthropic_get_workspace

Get detailed information about a specific Anthropic workspace, including its name, configuration, and usage settings.

Operation
Read read
Schema command
kosmo integrations:schema anthropic.anthropic_get_workspace --json
ParameterTypeRequiredDescription
id string yes The workspace identifier.

anthropic.anthropic_get_current_user

Get the authenticated user's profile and account information.

Operation
Read read
Schema command
kosmo integrations:schema anthropic.anthropic_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.