skills/count-tokens-in-a-message/SKILL.md
# Count Tokens In A Message Count the number of tokens that would be consumed by a message before sending it, enabling informed decisions about message length and token budget management. ## API Details - **API**: Anthropic Messages API - **Method**: POST - **Path**: `/v1/messages/count_tokens` - **Operation ID**: `countTokens` - **OpenAPI**: [anthropic-messages-api-openapi.yml](../../openapi/anthropic-messages-api-openapi.yml) ## Sandbox Mock server URL: `http://localhost:8080/rest/anthrop
npx skillsauth add naftiko/anthropic-sandbox skills/count-tokens-in-a-messageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Count the number of tokens that would be consumed by a message before sending it, enabling informed decisions about message length and token budget management.
/v1/messages/count_tokenscountTokensMock server URL: http://localhost:8080/rest/anthropic-models-api/2025-03-05/v1/messages/count_tokens
anthropic-version: 2023-06-01x-api-key: {api-key}Content-Type: application/json{
"model": "claude-sonnet-4-20250514",
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
]
}
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| model | string | Yes | The Claude model to use for token counting |
| messages | array | Yes | Messages to count tokens for |
| system | string/array | No | System prompt to include in count |
| tools | array | No | Tool definitions to include in count |
| thinking | object | No | Thinking configuration to include in count |
curl -X POST "http://localhost:8080/rest/anthropic-models-api/2025-03-05/v1/messages/count_tokens" \
-H "anthropic-version: 2023-06-01" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet-4-20250514", "messages": [{"role": "user", "content": "Hello, how are you?"}]}'
{
"input_tokens": 2095
}
When the user asks to count tokens in a message or wants to know the token cost before sending, use this operation by making a POST request to /v1/messages/count_tokens with the same parameters you would use for a message creation request (without actually sending it).
development
# Update Workspace Update the name or display color of an existing workspace. ## API Details - **API**: Anthropic Administrative API - **Method**: POST - **Path**: `/organizations/workspaces/{workspace_id}` - **Operation ID**: `updateWorkspace` - **OpenAPI**: [anthropic-admin-api-openapi.yml](../../openapi/anthropic-admin-api-openapi.yml) ## Sandbox Mock server URL: `http://localhost:8080/rest/anthropic-admin-api/1.0.0/organizations/workspaces/{workspace_id}` ## Required Headers - `anthro
development
# Update Workspace Member Update the workspace role of a specific member within a workspace. ## API Details - **API**: Anthropic Administrative API - **Method**: POST - **Path**: `/organizations/workspaces/{workspace_id}/members/{user_id}` - **Operation ID**: `updateWorkspaceMember` - **OpenAPI**: [anthropic-admin-api-openapi.yml](../../openapi/anthropic-admin-api-openapi.yml) ## Sandbox Mock server URL: `http://localhost:8080/rest/anthropic-admin-api/1.0.0/organizations/workspaces/{workspa
development
# Update Organization Member Update the role or other attributes of a specific user within the organization. ## API Details - **API**: Anthropic Administrative API - **Method**: POST - **Path**: `/organizations/users/{user_id}` - **Operation ID**: `updateOrganizationMember` - **OpenAPI**: [anthropic-admin-api-openapi.yml](../../openapi/anthropic-admin-api-openapi.yml) ## Sandbox Mock server URL: `http://localhost:8080/rest/anthropic-admin-api/1.0.0/organizations/users/{user_id}` ## Require
development
# Update API Key Update the name or status of an existing API key. Can be used to activate or deactivate a key. ## API Details - **API**: Anthropic Administrative API - **Method**: POST - **Path**: `/organizations/api_keys/{api_key_id}` - **Operation ID**: `updateApiKey` - **OpenAPI**: [anthropic-admin-api-openapi.yml](../../openapi/anthropic-admin-api-openapi.yml) ## Sandbox Mock server URL: `http://localhost:8080/rest/anthropic-admin-api/1.0.0/organizations/api_keys/{api_key_id}` ## Requ