KosmoKrator

productivity

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.

Anthropic CLI Setup

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

Install, configure, and verify
# 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 reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

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

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

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

Discovery

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

Discovery commands
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

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

anthropic.anthropic_list_messages

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

Read read
Parameters
model, limit, before_id, after_id
Generic call
kosmo integrations:call anthropic.anthropic_list_messages '{"model":"example_model","limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json
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

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

Write write
Parameters
model, messages, max_tokens, system, temperature, top_p, stop_sequences, stream
Generic 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
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_count_message_tokens

Count input tokens for a Messages API payload.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_count_message_tokens '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_count_message_tokens '{}' --json

anthropic.anthropic_create_message_batch

Create an asynchronous Message Batch.

Write write
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_create_message_batch '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_create_message_batch '{}' --json

anthropic.anthropic_list_message_batches

List Message Batches in the API key workspace.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_list_message_batches '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_list_message_batches '{}' --json

anthropic.anthropic_get_message_batch

Get processing status for one Message Batch.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_get_message_batch '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_message_batch '{}' --json

anthropic.anthropic_cancel_message_batch

Cancel an in-progress Message Batch.

Write write
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_cancel_message_batch '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_cancel_message_batch '{}' --json

anthropic.anthropic_delete_message_batch

Delete a completed Message Batch.

Write write
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_delete_message_batch '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_delete_message_batch '{}' --json

anthropic.anthropic_get_message_batch_results

Retrieve JSONL results for a completed Message Batch.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_get_message_batch_results '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_message_batch_results '{}' --json

anthropic.anthropic_list_models

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

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

anthropic.anthropic_get_model

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

Read read
Parameters
id
Generic call
kosmo integrations:call anthropic.anthropic_get_model '{"id":"example_id"}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_model '{"id":"example_id"}' --json

anthropic.anthropic_list_files

List files in the API key workspace.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_list_files '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_list_files '{}' --json

anthropic.anthropic_get_file

Get metadata for one Anthropic file.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_get_file '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_file '{}' --json

anthropic.anthropic_delete_file

Delete one Anthropic file.

Write write
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_delete_file '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_delete_file '{}' --json

anthropic.anthropic_download_file

Download content for a downloadable code-execution file.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_download_file '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_download_file '{}' --json

anthropic.anthropic_get_organization

Get organization information using the Admin API.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_get_organization '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_organization '{}' --json

anthropic.anthropic_list_workspaces

List Anthropic organization workspaces. Requires an Admin API key.

Read read
Parameters
limit, before_id, after_id, include_archived
Generic call
kosmo integrations:call anthropic.anthropic_list_workspaces '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id","include_archived":true}' --json
Shortcut
kosmo integrations:anthropic anthropic_list_workspaces '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id","include_archived":true}' --json

anthropic.anthropic_get_workspace

Get details for a specific Anthropic organization workspace. Requires an Admin API key.

Read read
Parameters
id
Generic call
kosmo integrations:call anthropic.anthropic_get_workspace '{"id":"example_id"}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_workspace '{"id":"example_id"}' --json

anthropic.anthropic_list_users

List organization users using the Admin API.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_list_users '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_list_users '{}' --json

anthropic.anthropic_get_user

Get one organization user using the Admin API.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_get_user '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_user '{}' --json

anthropic.anthropic_update_user

Update an organization user role using the Admin API.

Write write
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_update_user '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_update_user '{}' --json

anthropic.anthropic_remove_user

Remove an organization user using the Admin API.

Write write
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_remove_user '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_remove_user '{}' --json

anthropic.anthropic_list_api_keys

List organization API keys using the Admin API.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_list_api_keys '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_list_api_keys '{}' --json

anthropic.anthropic_get_api_key

Get one organization API key metadata record using the Admin API.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_get_api_key '{}' --json
Shortcut
kosmo integrations:anthropic anthropic_get_api_key '{}' --json

anthropic.anthropic_get_current_user

Backward-compatible alias for Anthropic organization information. Requires an Admin API key.

Read read
Parameters
none
Generic call
kosmo integrations:call anthropic.anthropic_get_current_user '{}' --json
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 4 parameters
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 8 parameters
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_count_message_tokens 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_count_message_tokens --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_create_message_batch 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_create_message_batch --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_list_message_batches 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_list_message_batches --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_get_message_batch 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_get_message_batch --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_cancel_message_batch 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_cancel_message_batch --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_delete_message_batch 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_delete_message_batch --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_get_message_batch_results 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_get_message_batch_results --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_list_models 3 parameters
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 1 parameters
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_files 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_list_files --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_get_file 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_get_file --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_delete_file 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_delete_file --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_download_file 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_download_file --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_get_organization 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_get_organization --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_list_workspaces 4 parameters
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.
include_archived boolean no Whether to include archived workspaces.
anthropic.anthropic_get_workspace 1 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_get_workspace --json
ParameterTypeRequiredDescription
id string yes The workspace identifier.
anthropic.anthropic_list_users 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_list_users --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_get_user 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_get_user --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_update_user 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_update_user --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_remove_user 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_remove_user --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_list_api_keys 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_list_api_keys --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_get_api_key 0 parameters
Schema command
kosmo integrations:schema anthropic.anthropic_get_api_key --json
ParameterTypeRequiredDescription
No parameters.
anthropic.anthropic_get_current_user 0 parameters
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.