claude

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateBatchMessagePayloadType = "claude.createBatchMessage.result"
)
View Source
const (
	GetDailyUsagePayloadType = "claude.getDailyUsage.result"
)
View Source
const MessagePayloadType = "claude.message"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorSummary added in v0.28.0

type ActorSummary struct {
	Actor        string `json:"actor"`
	Type         string `json:"type"`
	Sessions     int64  `json:"sessions"`
	LinesAdded   int64  `json:"linesAdded"`
	LinesRemoved int64  `json:"linesRemoved"`
	Commits      int64  `json:"commits"`
	PullRequests int64  `json:"pullRequests"`
}

ActorSummary is a per-user/per-API-key productivity rollup from the Claude Code usage report.

type BatchExecutionMetadata added in v0.29.0

type BatchExecutionMetadata struct {
	BatchID       string                     `json:"batchId,omitempty" mapstructure:"batchId,omitempty"`
	Status        string                     `json:"status,omitempty" mapstructure:"status,omitempty"`
	RequestCounts *MessageBatchRequestCounts `json:"requestCounts,omitempty" mapstructure:"requestCounts,omitempty"`
	// ItemCount is the number of Items elements the batch was built from, so
	// buildBatchOutput can size Results to it even if the results file is
	// missing trailing entries.
	ItemCount int `json:"itemCount,omitempty" mapstructure:"itemCount,omitempty"`
}

BatchExecutionMetadata is persisted for the run so poll() can find the batch again, and to surface live progress (RequestCounts) while it's still processing.

type BatchItemResult added in v0.29.0

type BatchItemResult struct {
	Index int `json:"index"`
	BatchResultOutcome
	Prompts map[string]BatchResultOutcome `json:"prompts,omitempty"`
}

BatchItemResult is one element of Items' result. In Single Prompt mode its outcome fields are set directly; in Multiple Prompts mode, Prompts holds one entry per configured prompt, keyed by its ID.

type BatchMessageItemSpec added in v0.29.0

type BatchMessageItemSpec struct {
	CustomID string
	Prompt   string
}

BatchMessageItemSpec is a single resolved request in the batch.

type BatchMessageNodeMetadata added in v0.29.0

type BatchMessageNodeMetadata struct {
	Model            string `json:"model" mapstructure:"model"`
	StructuredOutput bool   `json:"structuredOutput" mapstructure:"structuredOutput"`
}

BatchMessageNodeMetadata is node-level metadata surfaced in the UI.

type BatchMessagePromptSpec added in v0.29.0

type BatchMessagePromptSpec struct {
	ID     string `json:"id" mapstructure:"id"`
	Prompt string `json:"prompt" mapstructure:"prompt"`
}

BatchMessagePromptSpec is one prompt in "multiple" mode. It's combined with every element of Items to produce one request per (prompt, item) pair.

type BatchMessageSpec added in v0.29.0

type BatchMessageSpec struct {
	Items         string `json:"items" mapstructure:"items"`
	Model         string `json:"model" mapstructure:"model"`
	SystemMessage string `json:"systemMessage" mapstructure:"systemMessage"`

	// Mode selects how the batch's requests are built. See modeSingle / modeMultiple.
	Mode string `json:"mode" mapstructure:"mode"`

	OutputSchema string `json:"outputSchema" mapstructure:"outputSchema"`

	// Single mode: one prompt, applied to every element of Items.
	Prompt string `json:"prompt" mapstructure:"prompt"`

	// Multiple mode: several prompts, each applied to every element of Items.
	Prompts []BatchMessagePromptSpec `json:"prompts" mapstructure:"prompts"`
}

BatchMessageSpec is the workflow node configuration for claude.createBatchMessage.

type BatchOutput added in v0.29.0

type BatchOutput struct {
	Status        string                    `json:"status"` // ended | timeout | error
	BatchID       string                    `json:"batchId"`
	RequestCounts MessageBatchRequestCounts `json:"requestCounts"`
	Results       []BatchItemResult         `json:"results,omitempty"`
}

BatchOutput is the payload emitted when the batch reaches a terminal state. Results always has one entry per element of Items, in the same order.

type BatchRequestParams added in v0.29.0

type BatchRequestParams struct {
	Model        string        `json:"model"`
	Messages     []Message     `json:"messages"`
	System       string        `json:"system,omitempty"`
	MaxTokens    int           `json:"max_tokens,omitempty"`
	Temperature  *float64      `json:"temperature,omitempty"`
	OutputConfig *OutputConfig `json:"output_config,omitempty"`
}

BatchRequestParams mirrors CreateMessageRequest but is used specifically for the per-item "params" object of a Message Batches request.

type BatchResultOutcome added in v0.29.0

type BatchResultOutcome struct {
	Type         string        `json:"type"` // succeeded | errored | canceled | expired
	Text         string        `json:"text,omitempty"`
	Parsed       any           `json:"parsed,omitempty"`
	StopReason   string        `json:"stopReason,omitempty"`
	Usage        *MessageUsage `json:"usage,omitempty"`
	ErrorType    string        `json:"errorType,omitempty"`
	ErrorMessage string        `json:"errorMessage,omitempty"`
}

BatchResultOutcome is one request's outcome: either a whole item's result (Single Prompt mode) or one prompt's result for an item (Multiple Prompts mode, nested under BatchItemResult.Prompts).

type Claude

type Claude struct{}

func (*Claude) Actions

func (i *Claude) Actions() []core.Action

func (*Claude) Cleanup

func (i *Claude) Cleanup(ctx core.IntegrationCleanupContext) error

func (*Claude) Configuration

func (i *Claude) Configuration() []configuration.Field

func (*Claude) Description

func (i *Claude) Description() string

func (*Claude) HandleHook added in v0.18.0

func (i *Claude) HandleHook(ctx core.IntegrationHookContext) error

func (*Claude) HandleRequest

func (i *Claude) HandleRequest(ctx core.HTTPRequestContext)

func (*Claude) Hooks added in v0.18.0

func (i *Claude) Hooks() []core.Hook

func (*Claude) Icon

func (i *Claude) Icon() string

func (*Claude) Instructions

func (i *Claude) Instructions() string

func (*Claude) Label

func (i *Claude) Label() string

func (*Claude) ListResources

func (i *Claude) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Claude) Name

func (i *Claude) Name() string

func (*Claude) Sync

func (i *Claude) Sync(ctx core.SyncContext) error

func (*Claude) Triggers

func (i *Claude) Triggers() []core.Trigger

type ClaudeCodeActor added in v0.28.0

type ClaudeCodeActor struct {
	Type         string `json:"type"`
	EmailAddress string `json:"email_address"`
	APIKeyName   string `json:"api_key_name"`
}

func (ClaudeCodeActor) Name added in v0.28.0

func (a ClaudeCodeActor) Name() string

type ClaudeCodeCoreMetrics added in v0.28.0

type ClaudeCodeCoreMetrics struct {
	CommitsByClaudeCode      int64                 `json:"commits_by_claude_code"`
	LinesOfCode              ClaudeCodeLinesOfCode `json:"lines_of_code"`
	NumSessions              int64                 `json:"num_sessions"`
	PullRequestsByClaudeCode int64                 `json:"pull_requests_by_claude_code"`
}

type ClaudeCodeEstimatedCost added in v0.28.0

type ClaudeCodeEstimatedCost struct {
	Amount   float64 `json:"amount"`
	Currency string  `json:"currency"`
}

type ClaudeCodeLinesOfCode added in v0.28.0

type ClaudeCodeLinesOfCode struct {
	Added   int64 `json:"added"`
	Removed int64 `json:"removed"`
}

type ClaudeCodeModelBreakdown added in v0.28.0

type ClaudeCodeModelBreakdown struct {
	Model         string                  `json:"model"`
	EstimatedCost ClaudeCodeEstimatedCost `json:"estimated_cost"`
	Tokens        ClaudeCodeModelTokens   `json:"tokens"`
}

type ClaudeCodeModelTokens added in v0.28.0

type ClaudeCodeModelTokens struct {
	CacheCreation int64 `json:"cache_creation"`
	CacheRead     int64 `json:"cache_read"`
	Input         int64 `json:"input"`
	Output        int64 `json:"output"`
}

type ClaudeCodeSummary added in v0.28.0

type ClaudeCodeSummary struct {
	Sessions            int64          `json:"sessions"`
	LinesAdded          int64          `json:"linesAdded"`
	LinesRemoved        int64          `json:"linesRemoved"`
	Commits             int64          `json:"commits"`
	PullRequests        int64          `json:"pullRequests"`
	ToolActionsAccepted int64          `json:"toolActionsAccepted"`
	ToolActionsRejected int64          `json:"toolActionsRejected"`
	EstimatedCostUsd    float64        `json:"estimatedCostUsd"`
	ByModel             []ModelCost    `json:"byModel"`
	ByActor             []ActorSummary `json:"byActor"`
}

ClaudeCodeSummary rolls up Claude Code productivity metrics and cost.

type ClaudeCodeToolAction added in v0.28.0

type ClaudeCodeToolAction struct {
	Accepted int64 `json:"accepted"`
	Rejected int64 `json:"rejected"`
}

type ClaudeCodeUsageRecord added in v0.28.0

type ClaudeCodeUsageRecord struct {
	Actor          ClaudeCodeActor                 `json:"actor"`
	Date           string                          `json:"date"`
	CoreMetrics    ClaudeCodeCoreMetrics           `json:"core_metrics"`
	ModelBreakdown []ClaudeCodeModelBreakdown      `json:"model_breakdown"`
	ToolActions    map[string]ClaudeCodeToolAction `json:"tool_actions"`
}

type ClaudeCodeUsageReportResponse added in v0.28.0

type ClaudeCodeUsageReportResponse struct {
	Data     []ClaudeCodeUsageRecord `json:"data"`
	HasMore  bool                    `json:"has_more"`
	NextPage string                  `json:"next_page"`
}

ClaudeCodeUsageReportResponse is the response of GET /v1/organizations/usage_report/claude_code.

type Client

type Client struct {
	APIKey   string
	AdminKey string
	BaseURL  string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient core.HTTPContext, ctx core.IntegrationContext) (*Client, error)

func (*Client) CancelMessageBatch added in v0.29.0

func (c *Client) CancelMessageBatch(batchID string) error

CancelMessageBatch requests cancellation of a still-processing batch (POST /v1/messages/batches/{id}/cancel). Already-completed requests are unaffected.

func (*Client) CreateMessage

func (c *Client) CreateMessage(req CreateMessageRequest) (*CreateMessageResponse, error)

func (*Client) CreateMessageBatch added in v0.29.0

func (c *Client) CreateMessageBatch(items []CreateMessageBatchRequestItem) (*MessageBatch, error)

CreateMessageBatch submits a batch of Messages API requests for asynchronous processing.

func (*Client) DeleteFile added in v0.28.0

func (c *Client) DeleteFile(fileID string) error

DeleteFile removes an uploaded file. Best-effort cleanup; no-op for empty IDs.

func (*Client) DownloadFile added in v0.29.0

func (c *Client) DownloadFile(fileID string) ([]byte, error)

DownloadFile fetches a file's raw content (GET /v1/files/{id}/content). Only files with downloadable=true (created by code execution, skills, or agent sessions) can be downloaded; the API rejects user-uploaded files.

func (*Client) FileContentURL added in v0.29.0

func (c *Client) FileContentURL(fileID string) string

FileContentURL returns the programmatic download link for a file. Requests to it require the API key headers, including the files beta.

func (*Client) GetClaudeCodeUsageReport added in v0.28.0

func (c *Client) GetClaudeCodeUsageReport(startDate, endDate time.Time) ([]ClaudeCodeUsageRecord, error)

GetClaudeCodeUsageReport fetches per-day, per-actor Claude Code productivity metrics for every day between startDate and endDate (inclusive). The upstream endpoint only accepts a single day per call, so this issues one request (plus pagination) per day in range.

func (*Client) GetFileMetadata added in v0.29.0

func (c *Client) GetFileMetadata(fileID string) (*FileMetadata, error)

GetFileMetadata retrieves a single file's metadata (GET /v1/files/{id}).

func (*Client) GetMessageBatch added in v0.29.0

func (c *Client) GetMessageBatch(batchID string) (*MessageBatch, error)

GetMessageBatch retrieves the current status of a batch (GET /v1/messages/batches/{id}).

func (*Client) GetMessageBatchResults added in v0.29.0

func (c *Client) GetMessageBatchResults(batchID string) ([]MessageBatchResult, error)

GetMessageBatchResults streams and parses the batch's results file (GET /v1/messages/batches/{id}/results), which is a JSONL document — one JSON object per line, in no particular order. Only callable once processing_status is "ended".

func (*Client) GetMessagesUsageReport added in v0.28.0

func (c *Client) GetMessagesUsageReport(startingAt, endingAt string, days int) ([]MessagesUsageBucket, error)

GetMessagesUsageReport fetches per-day, per-model token usage between startingAt (inclusive) and endingAt (exclusive), both RFC 3339 timestamps.

func (*Client) ListModels

func (c *Client) ListModels() ([]Model, error)

func (*Client) UploadFile added in v0.28.0

func (c *Client) UploadFile(content io.Reader, filename, contentType string) (string, error)

UploadFile uploads a file to the Anthropic Files API and returns its file_id.

func (*Client) Verify

func (c *Client) Verify() error

type Configuration

type Configuration struct {
	APIKey   string `json:"apiKey"`
	AdminKey string `json:"adminKey"`
}

type ContentBlock added in v0.26.0

type ContentBlock struct {
	Type   string              `json:"type"`
	Text   string              `json:"text,omitempty"`
	Source *ContentBlockSource `json:"source,omitempty"`
}

ContentBlock represents a content block in a Claude message. Used for text, images, and documents.

type ContentBlockSource added in v0.26.0

type ContentBlockSource struct {
	Type      string `json:"type"`
	MediaType string `json:"media_type,omitempty"`
	Data      string `json:"data,omitempty"`
	FileID    string `json:"file_id,omitempty"`
}

ContentBlockSource describes the source of an image/document content block. Type "text"/"base64" carry MediaType+Data inline; type "file" references a Files API file_id.

type CreateBatchMessage added in v0.29.0

type CreateBatchMessage struct{}

func (*CreateBatchMessage) Cancel added in v0.29.0

func (*CreateBatchMessage) Cleanup added in v0.29.0

func (c *CreateBatchMessage) Cleanup(ctx core.SetupContext) error

func (*CreateBatchMessage) Color added in v0.29.0

func (c *CreateBatchMessage) Color() string

func (*CreateBatchMessage) Configuration added in v0.29.0

func (c *CreateBatchMessage) Configuration() []configuration.Field

func (*CreateBatchMessage) Description added in v0.29.0

func (c *CreateBatchMessage) Description() string

func (*CreateBatchMessage) Documentation added in v0.29.0

func (c *CreateBatchMessage) Documentation() string

func (*CreateBatchMessage) ExampleOutput added in v0.29.0

func (c *CreateBatchMessage) ExampleOutput() map[string]any

func (*CreateBatchMessage) Execute added in v0.29.0

func (*CreateBatchMessage) HandleHook added in v0.29.0

func (c *CreateBatchMessage) HandleHook(ctx core.ActionHookContext) error

func (*CreateBatchMessage) HandleWebhook added in v0.29.0

func (*CreateBatchMessage) Hooks added in v0.29.0

func (c *CreateBatchMessage) Hooks() []core.Hook

func (*CreateBatchMessage) Icon added in v0.29.0

func (c *CreateBatchMessage) Icon() string

func (*CreateBatchMessage) Label added in v0.29.0

func (c *CreateBatchMessage) Label() string

func (*CreateBatchMessage) Name added in v0.29.0

func (c *CreateBatchMessage) Name() string

func (*CreateBatchMessage) OutputChannels added in v0.29.0

func (c *CreateBatchMessage) OutputChannels(config any) []core.OutputChannel

func (*CreateBatchMessage) ProcessQueueItem added in v0.29.0

func (c *CreateBatchMessage) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateBatchMessage) Setup added in v0.29.0

func (c *CreateBatchMessage) Setup(ctx core.SetupContext) error

type CreateMessageBatchRequestItem added in v0.29.0

type CreateMessageBatchRequestItem struct {
	CustomID string             `json:"custom_id"`
	Params   BatchRequestParams `json:"params"`
}

CreateMessageBatchRequestItem is a single entry in a POST /v1/messages/batches request.

type CreateMessageRequest

type CreateMessageRequest struct {
	Model        string        `json:"model"`
	Messages     []Message     `json:"messages"`
	System       string        `json:"system,omitempty"`
	MaxTokens    int           `json:"max_tokens,omitempty"`
	Temperature  *float64      `json:"temperature,omitempty"`
	OutputConfig *OutputConfig `json:"output_config,omitempty"`
	Tools        []any         `json:"tools,omitempty"`
}

type CreateMessageResponse

type CreateMessageResponse struct {
	ID           string           `json:"id"`
	Type         string           `json:"type"`
	Role         string           `json:"role"`
	Content      []MessageContent `json:"content"`
	Model        string           `json:"model"`
	StopReason   string           `json:"stop_reason"`
	StopSequence string           `json:"stop_sequence,omitempty"`
	Usage        MessageUsage     `json:"usage"`
}

type DailyUsage added in v0.28.0

type DailyUsage struct {
	Date                 string  `json:"date"`
	MessagesInputTokens  int64   `json:"messagesInputTokens"`
	MessagesOutputTokens int64   `json:"messagesOutputTokens"`
	CodeSessions         int64   `json:"codeSessions"`
	CodeLinesAdded       int64   `json:"codeLinesAdded"`
	CodeLinesRemoved     int64   `json:"codeLinesRemoved"`
	CodeCommits          int64   `json:"codeCommits"`
	CodePullRequests     int64   `json:"codePullRequests"`
	CodeEstimatedCostUsd float64 `json:"codeEstimatedCostUsd"`
}

DailyUsage is an org-wide, per-calendar-day rollup combining both reports, for trend charts.

type FileArtifact added in v0.29.0

type FileArtifact struct {
	FileID      string `json:"fileId"`
	Filename    string `json:"filename"`
	MimeType    string `json:"mimeType"`
	SizeBytes   int64  `json:"sizeBytes"`
	Encoding    string `json:"encoding,omitempty"`
	Content     string `json:"content,omitempty"`
	DownloadURL string `json:"downloadUrl"`
}

FileArtifact is a file Claude generated during the request (via code execution). Its content is embedded in the payload — text files as a plain string, everything else base64-encoded — so downstream steps can consume it directly. Files over the inline size cap carry metadata and the download link only.

type FileMetadata added in v0.29.0

type FileMetadata struct {
	ID           string `json:"id"`
	Type         string `json:"type"`
	Filename     string `json:"filename"`
	MimeType     string `json:"mime_type"`
	SizeBytes    int64  `json:"size_bytes"`
	CreatedAt    string `json:"created_at"`
	Downloadable bool   `json:"downloadable"`
}

FileMetadata is a file stored in the Anthropic Files API.

type GetDailyUsage added in v0.28.0

type GetDailyUsage struct{}

func (*GetDailyUsage) Cancel added in v0.28.0

func (c *GetDailyUsage) Cancel(ctx core.ExecutionContext) error

func (*GetDailyUsage) Cleanup added in v0.28.0

func (c *GetDailyUsage) Cleanup(ctx core.SetupContext) error

func (*GetDailyUsage) Color added in v0.28.0

func (c *GetDailyUsage) Color() string

func (*GetDailyUsage) Configuration added in v0.28.0

func (c *GetDailyUsage) Configuration() []configuration.Field

func (*GetDailyUsage) Description added in v0.28.0

func (c *GetDailyUsage) Description() string

func (*GetDailyUsage) Documentation added in v0.28.0

func (c *GetDailyUsage) Documentation() string

func (*GetDailyUsage) ExampleOutput added in v0.28.0

func (c *GetDailyUsage) ExampleOutput() map[string]any

func (*GetDailyUsage) Execute added in v0.28.0

func (c *GetDailyUsage) Execute(ctx core.ExecutionContext) error

func (*GetDailyUsage) HandleHook added in v0.28.0

func (c *GetDailyUsage) HandleHook(ctx core.ActionHookContext) error

func (*GetDailyUsage) HandleWebhook added in v0.28.0

func (*GetDailyUsage) Hooks added in v0.28.0

func (c *GetDailyUsage) Hooks() []core.Hook

func (*GetDailyUsage) Icon added in v0.28.0

func (c *GetDailyUsage) Icon() string

func (*GetDailyUsage) Label added in v0.28.0

func (c *GetDailyUsage) Label() string

func (*GetDailyUsage) Name added in v0.28.0

func (c *GetDailyUsage) Name() string

func (*GetDailyUsage) OutputChannels added in v0.28.0

func (c *GetDailyUsage) OutputChannels(config any) []core.OutputChannel

func (*GetDailyUsage) ProcessQueueItem added in v0.28.0

func (c *GetDailyUsage) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetDailyUsage) Setup added in v0.28.0

func (c *GetDailyUsage) Setup(ctx core.SetupContext) error

type GetDailyUsageOutput added in v0.28.0

type GetDailyUsageOutput struct {
	Period     Period            `json:"period"`
	Messages   MessagesSummary   `json:"messages"`
	ClaudeCode ClaudeCodeSummary `json:"claudeCode"`
	Daily      []DailyUsage      `json:"daily"`
}

type GetDailyUsageSpec added in v0.28.0

type GetDailyUsageSpec struct {
	StartDate string `json:"startDate" mapstructure:"startDate"`
	EndDate   string `json:"endDate" mapstructure:"endDate"`
}

type Message

type Message struct {
	Role    string `json:"role"`
	Content any    `json:"content"`
}

Message represents a Claude API message. Content can be a plain string (for simple text) or []ContentBlock (for multi-part content with documents, images and text).

type MessageBatch added in v0.29.0

type MessageBatch struct {
	ID               string                    `json:"id"`
	Type             string                    `json:"type"`
	ProcessingStatus string                    `json:"processing_status"`
	RequestCounts    MessageBatchRequestCounts `json:"request_counts"`
	CreatedAt        string                    `json:"created_at,omitempty"`
	EndedAt          string                    `json:"ended_at,omitempty"`
	ExpiresAt        string                    `json:"expires_at,omitempty"`
	ResultsURL       string                    `json:"results_url,omitempty"`
}

MessageBatch is the resource returned by the Message Batches API.

type MessageBatchRequestCounts added in v0.29.0

type MessageBatchRequestCounts struct {
	Processing int `json:"processing"`
	Succeeded  int `json:"succeeded"`
	Errored    int `json:"errored"`
	Canceled   int `json:"canceled"`
	Expired    int `json:"expired"`
}

MessageBatchRequestCounts summarizes the processing status of every request in a batch.

type MessageBatchResult added in v0.29.0

type MessageBatchResult struct {
	CustomID string                 `json:"custom_id"`
	Result   messageBatchResultBody `json:"result"`
}

MessageBatchResult is a single line of the batch results JSONL stream.

type MessageBatchResultError added in v0.29.0

type MessageBatchResultError struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

MessageBatchResultError is the error object of an "errored" batch result.

type MessageContent

type MessageContent struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
	// Content carries the nested payload of tool-result blocks (e.g. code
	// execution results referencing generated file_ids). Kept raw so unknown
	// block shapes round-trip untouched.
	Content json.RawMessage `json:"content,omitempty"`
}

type MessagePayload

type MessagePayload struct {
	ID         string                 `json:"id"`
	Model      string                 `json:"model"`
	Text       string                 `json:"text"`
	Parsed     any                    `json:"parsed,omitempty"`
	Usage      *MessageUsage          `json:"usage,omitempty"`
	StopReason string                 `json:"stopReason,omitempty"`
	Artifacts  []FileArtifact         `json:"artifacts,omitempty"`
	Response   *CreateMessageResponse `json:"response"`
}

type MessageUsage

type MessageUsage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

type MessagesSummary added in v0.28.0

type MessagesSummary struct {
	InputTokens         int64        `json:"inputTokens"`
	OutputTokens        int64        `json:"outputTokens"`
	CacheReadTokens     int64        `json:"cacheReadTokens"`
	CacheCreationTokens int64        `json:"cacheCreationTokens"`
	WebSearchRequests   int64        `json:"webSearchRequests"`
	ByModel             []ModelUsage `json:"byModel"`
}

MessagesSummary rolls up raw API/SDK usage. The Messages usage report has no cost or request-count field, only token counts.

type MessagesUsageBucket added in v0.28.0

type MessagesUsageBucket struct {
	StartingAt string                `json:"starting_at"`
	EndingAt   string                `json:"ending_at"`
	Results    []MessagesUsageResult `json:"results"`
}

type MessagesUsageCacheCreation added in v0.28.0

type MessagesUsageCacheCreation struct {
	Ephemeral1hInputTokens int64 `json:"ephemeral_1h_input_tokens"`
	Ephemeral5mInputTokens int64 `json:"ephemeral_5m_input_tokens"`
}

type MessagesUsageReportResponse added in v0.28.0

type MessagesUsageReportResponse struct {
	Data     []MessagesUsageBucket `json:"data"`
	HasMore  bool                  `json:"has_more"`
	NextPage string                `json:"next_page"`
}

MessagesUsageReportResponse is the response of GET /v1/organizations/usage_report/messages.

type MessagesUsageResult added in v0.28.0

type MessagesUsageResult struct {
	Model                string                     `json:"model"`
	UncachedInputTokens  int64                      `json:"uncached_input_tokens"`
	OutputTokens         int64                      `json:"output_tokens"`
	CacheReadInputTokens int64                      `json:"cache_read_input_tokens"`
	CacheCreation        MessagesUsageCacheCreation `json:"cache_creation"`
	ServerToolUse        MessagesUsageServerTool    `json:"server_tool_use"`
}

type MessagesUsageServerTool added in v0.28.0

type MessagesUsageServerTool struct {
	WebSearchRequests int64 `json:"web_search_requests"`
}

type Model

type Model struct {
	ID string `json:"id"`
}

type ModelCost added in v0.28.0

type ModelCost struct {
	Model            string  `json:"model"`
	InputTokens      int64   `json:"inputTokens"`
	OutputTokens     int64   `json:"outputTokens"`
	EstimatedCostUsd float64 `json:"estimatedCostUsd"`
}

ModelCost is a per-model token and cost rollup from the Claude Code usage report.

type ModelUsage added in v0.28.0

type ModelUsage struct {
	Model               string `json:"model"`
	InputTokens         int64  `json:"inputTokens"`
	OutputTokens        int64  `json:"outputTokens"`
	CacheReadTokens     int64  `json:"cacheReadTokens"`
	CacheCreationTokens int64  `json:"cacheCreationTokens"`
}

ModelUsage is a per-model token rollup from the Messages usage report.

type ModelsResponse

type ModelsResponse struct {
	Data []Model `json:"data"`
}

type OutputConfig added in v0.28.0

type OutputConfig struct {
	Format *OutputFormat `json:"format,omitempty"`
}

OutputConfig configures Claude's response format (structured outputs). See https://platform.claude.com/docs/en/build-with-claude/structured-outputs

type OutputFormat added in v0.28.0

type OutputFormat struct {
	Type   string `json:"type"`   // always "json_schema"
	Schema any    `json:"schema"` // the JSON Schema object
}

OutputFormat constrains the final text response to a JSON schema.

type Period added in v0.28.0

type Period struct {
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type TextPrompt

type TextPrompt struct{}

func (*TextPrompt) Cancel

func (c *TextPrompt) Cancel(ctx core.ExecutionContext) error

func (*TextPrompt) Cleanup

func (c *TextPrompt) Cleanup(ctx core.SetupContext) error

func (*TextPrompt) Color

func (c *TextPrompt) Color() string

func (*TextPrompt) Configuration

func (c *TextPrompt) Configuration() []configuration.Field

func (*TextPrompt) Description

func (c *TextPrompt) Description() string

func (*TextPrompt) Documentation

func (c *TextPrompt) Documentation() string

func (*TextPrompt) ExampleOutput

func (c *TextPrompt) ExampleOutput() map[string]any

func (*TextPrompt) Execute

func (c *TextPrompt) Execute(ctx core.ExecutionContext) error

func (*TextPrompt) HandleHook added in v0.18.0

func (c *TextPrompt) HandleHook(ctx core.ActionHookContext) error

func (*TextPrompt) HandleWebhook

func (*TextPrompt) Hooks added in v0.18.0

func (c *TextPrompt) Hooks() []core.Hook

func (*TextPrompt) Icon

func (c *TextPrompt) Icon() string

func (*TextPrompt) Label

func (c *TextPrompt) Label() string

func (*TextPrompt) Name

func (c *TextPrompt) Name() string

func (*TextPrompt) OutputChannels

func (c *TextPrompt) OutputChannels(configuration any) []core.OutputChannel

func (*TextPrompt) ProcessQueueItem

func (c *TextPrompt) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*TextPrompt) Setup

func (c *TextPrompt) Setup(ctx core.SetupContext) error

type TextPromptNodeMetadata added in v0.28.0

type TextPromptNodeMetadata struct {
	Model            string `json:"model" mapstructure:"model"`
	StructuredOutput bool   `json:"structuredOutput" mapstructure:"structuredOutput"`
	CodeExecution    bool   `json:"codeExecution" mapstructure:"codeExecution"`
}

TextPromptNodeMetadata is node-level metadata surfaced in the UI so the configured model and options are visible on the node without opening it.

type TextPromptSpec

type TextPromptSpec struct {
	Model         string   `json:"model"`
	SystemMessage string   `json:"systemMessage"`
	Prompt        string   `json:"prompt"`
	Files         []string `json:"files"`
	CodeExecution bool     `json:"codeExecution"`
	OutputSchema  string   `json:"outputSchema"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL