arazzo: 1.0.1 info: title: Claude Select Model and Create Message summary: Discover an available Claude model, confirm its metadata, then generate a message with it. description: >- A model-aware completion flow. The workflow first lists the available Claude models so the most recently released model can be selected, then retrieves that model's metadata to confirm its identifier and display name, and finally sends a single-turn prompt to the Messages API using the resolved model. Every step spells out its request inline — including the required x-api-key and anthropic-version headers — so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: claudeApi url: ../openapi/claude-messages-api.yml type: openapi workflows: - workflowId: select-model-and-create-message summary: Pick the latest available model and use it to generate a message. description: >- Lists models, retrieves metadata for the most recently released model, and sends a prompt to that model, returning the generated text and token usage. inputs: type: object required: - apiKey - prompt properties: apiKey: type: string description: Anthropic API key sent in the x-api-key header. anthropicVersion: type: string description: Value for the required anthropic-version header. default: '2023-06-01' prompt: type: string description: The user prompt to send to the selected model. maxTokens: type: integer description: Maximum number of tokens to generate. default: 1024 steps: - stepId: listAvailableModels description: >- List available Claude models. The most recently released models are returned first, so the first item is the newest model. operationId: listModels parameters: - name: x-api-key in: header value: $inputs.apiKey - name: anthropic-version in: header value: $inputs.anthropicVersion - name: limit in: query value: 20 successCriteria: - condition: $statusCode == 200 outputs: latestModelId: $response.body#/data/0/id hasMore: $response.body#/has_more - stepId: confirmModel description: >- Retrieve metadata for the newest model to confirm its identifier and human-readable display name before using it. operationId: getModel parameters: - name: x-api-key in: header value: $inputs.apiKey - name: anthropic-version in: header value: $inputs.anthropicVersion - name: model_id in: path value: $steps.listAvailableModels.outputs.latestModelId successCriteria: - condition: $statusCode == 200 outputs: modelId: $response.body#/id displayName: $response.body#/display_name - stepId: createMessage description: >- Send a single-turn user prompt to the confirmed model and capture the generated content and token usage. operationId: createMessage parameters: - name: x-api-key in: header value: $inputs.apiKey - name: anthropic-version in: header value: $inputs.anthropicVersion requestBody: contentType: application/json payload: model: $steps.confirmModel.outputs.modelId max_tokens: $inputs.maxTokens messages: - role: user content: $inputs.prompt successCriteria: - condition: $statusCode == 200 outputs: messageId: $response.body#/id content: $response.body#/content stopReason: $response.body#/stop_reason usage: $response.body#/usage outputs: modelId: $steps.confirmModel.outputs.modelId displayName: $steps.confirmModel.outputs.displayName messageId: $steps.createMessage.outputs.messageId content: $steps.createMessage.outputs.content usage: $steps.createMessage.outputs.usage