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 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.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
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.
kosmo integrations:call anthropic.anthropic_list_messages '{"model":"example_model","limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json 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.
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 - Parameters
- model, limit, before_id, after_id
kosmo integrations:call anthropic.anthropic_list_messages '{"model":"example_model","limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json 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 - Parameters
- model, messages, max_tokens, system, temperature, top_p, stop_sequences, stream
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 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 - Parameters
- none
kosmo integrations:call anthropic.anthropic_count_message_tokens '{}' --json kosmo integrations:anthropic anthropic_count_message_tokens '{}' --json anthropic.anthropic_create_message_batch
Create an asynchronous Message Batch.
write - Parameters
- none
kosmo integrations:call anthropic.anthropic_create_message_batch '{}' --json kosmo integrations:anthropic anthropic_create_message_batch '{}' --json anthropic.anthropic_list_message_batches
List Message Batches in the API key workspace.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_list_message_batches '{}' --json kosmo integrations:anthropic anthropic_list_message_batches '{}' --json anthropic.anthropic_get_message_batch
Get processing status for one Message Batch.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_get_message_batch '{}' --json kosmo integrations:anthropic anthropic_get_message_batch '{}' --json anthropic.anthropic_cancel_message_batch
Cancel an in-progress Message Batch.
write - Parameters
- none
kosmo integrations:call anthropic.anthropic_cancel_message_batch '{}' --json kosmo integrations:anthropic anthropic_cancel_message_batch '{}' --json anthropic.anthropic_delete_message_batch
Delete a completed Message Batch.
write - Parameters
- none
kosmo integrations:call anthropic.anthropic_delete_message_batch '{}' --json kosmo integrations:anthropic anthropic_delete_message_batch '{}' --json anthropic.anthropic_get_message_batch_results
Retrieve JSONL results for a completed Message Batch.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_get_message_batch_results '{}' --json 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 - Parameters
- limit, before_id, after_id
kosmo integrations:call anthropic.anthropic_list_models '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id"}' --json 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 - Parameters
- id
kosmo integrations:call anthropic.anthropic_get_model '{"id":"example_id"}' --json kosmo integrations:anthropic anthropic_get_model '{"id":"example_id"}' --json anthropic.anthropic_list_files
List files in the API key workspace.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_list_files '{}' --json kosmo integrations:anthropic anthropic_list_files '{}' --json anthropic.anthropic_get_file
Get metadata for one Anthropic file.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_get_file '{}' --json kosmo integrations:anthropic anthropic_get_file '{}' --json anthropic.anthropic_delete_file
Delete one Anthropic file.
write - Parameters
- none
kosmo integrations:call anthropic.anthropic_delete_file '{}' --json kosmo integrations:anthropic anthropic_delete_file '{}' --json anthropic.anthropic_download_file
Download content for a downloadable code-execution file.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_download_file '{}' --json kosmo integrations:anthropic anthropic_download_file '{}' --json anthropic.anthropic_get_organization
Get organization information using the Admin API.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_get_organization '{}' --json kosmo integrations:anthropic anthropic_get_organization '{}' --json anthropic.anthropic_list_workspaces
List Anthropic organization workspaces. Requires an Admin API key.
read - Parameters
- limit, before_id, after_id, include_archived
kosmo integrations:call anthropic.anthropic_list_workspaces '{"limit":1,"before_id":"example_before_id","after_id":"example_after_id","include_archived":true}' --json 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 - Parameters
- id
kosmo integrations:call anthropic.anthropic_get_workspace '{"id":"example_id"}' --json kosmo integrations:anthropic anthropic_get_workspace '{"id":"example_id"}' --json anthropic.anthropic_list_users
List organization users using the Admin API.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_list_users '{}' --json kosmo integrations:anthropic anthropic_list_users '{}' --json anthropic.anthropic_get_user
Get one organization user using the Admin API.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_get_user '{}' --json kosmo integrations:anthropic anthropic_get_user '{}' --json anthropic.anthropic_update_user
Update an organization user role using the Admin API.
write - Parameters
- none
kosmo integrations:call anthropic.anthropic_update_user '{}' --json kosmo integrations:anthropic anthropic_update_user '{}' --json anthropic.anthropic_remove_user
Remove an organization user using the Admin API.
write - Parameters
- none
kosmo integrations:call anthropic.anthropic_remove_user '{}' --json kosmo integrations:anthropic anthropic_remove_user '{}' --json anthropic.anthropic_list_api_keys
List organization API keys using the Admin API.
read - Parameters
- none
kosmo integrations:call anthropic.anthropic_list_api_keys '{}' --json 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 - Parameters
- none
kosmo integrations:call anthropic.anthropic_get_api_key '{}' --json 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 - Parameters
- none
kosmo integrations:call anthropic.anthropic_get_current_user '{}' --json 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
kosmo integrations:schema anthropic.anthropic_list_messages --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema anthropic.anthropic_create_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema anthropic.anthropic_count_message_tokens --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_create_message_batch 0 parameters
kosmo integrations:schema anthropic.anthropic_create_message_batch --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_list_message_batches 0 parameters
kosmo integrations:schema anthropic.anthropic_list_message_batches --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_get_message_batch 0 parameters
kosmo integrations:schema anthropic.anthropic_get_message_batch --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_cancel_message_batch 0 parameters
kosmo integrations:schema anthropic.anthropic_cancel_message_batch --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_delete_message_batch 0 parameters
kosmo integrations:schema anthropic.anthropic_delete_message_batch --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_get_message_batch_results 0 parameters
kosmo integrations:schema anthropic.anthropic_get_message_batch_results --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_list_models 3 parameters
kosmo integrations:schema anthropic.anthropic_list_models --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema anthropic.anthropic_get_model --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The model identifier (e.g., "claude-sonnet-4-20250514"). |
anthropic.anthropic_list_files 0 parameters
kosmo integrations:schema anthropic.anthropic_list_files --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_get_file 0 parameters
kosmo integrations:schema anthropic.anthropic_get_file --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_delete_file 0 parameters
kosmo integrations:schema anthropic.anthropic_delete_file --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_download_file 0 parameters
kosmo integrations:schema anthropic.anthropic_download_file --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_get_organization 0 parameters
kosmo integrations:schema anthropic.anthropic_get_organization --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_list_workspaces 4 parameters
kosmo integrations:schema anthropic.anthropic_list_workspaces --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema anthropic.anthropic_get_workspace --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The workspace identifier. |
anthropic.anthropic_list_users 0 parameters
kosmo integrations:schema anthropic.anthropic_list_users --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_get_user 0 parameters
kosmo integrations:schema anthropic.anthropic_get_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_update_user 0 parameters
kosmo integrations:schema anthropic.anthropic_update_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_remove_user 0 parameters
kosmo integrations:schema anthropic.anthropic_remove_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_list_api_keys 0 parameters
kosmo integrations:schema anthropic.anthropic_list_api_keys --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_get_api_key 0 parameters
kosmo integrations:schema anthropic.anthropic_get_api_key --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
anthropic.anthropic_get_current_user 0 parameters
kosmo integrations:schema anthropic.anthropic_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| 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.