Urgent.News

What's breaking now, across thousands of outlets.

AI

๐Ÿ’ธ What Does One Amazon Bedrock Prompt Cost? Find Out From the CLI (Hands-on)

๐ŸŽค The interview question "Your team wants to add an Amazon Bedrock chatbot. How would you work out what one prompt costs?" It shows up in AIF-C01 prep and in real interviews. The strong answer: Bedrock charges per token, and every response tells you how many tokens it used. Let's prove that from the AWS CLI in 5 minutes. ๐Ÿ‘‡ ๐Ÿ‘‰ Flow: Send one prompt โ†’ Read usage โ†’ Multiply by the price โ†’ Compareโ€ฆ

How much does a single Amazon Bedrock prompt cost? To find out, you can use the AWS Command Line Interface (CLI) to send a prompt to Bedrock, analyze the response for token usage, and then convert those tokens into a monetary value. Here's a hands-on demonstration of the process:

1. **Set Up**: Ensure you have AWS CLI v2 installed and configured with the correct region (us-east-1) and permissions to access Bedrock. Verify you have access to the Amazon Nova Micro model.

2. **Send a Prompt**: Use the Converse API to send a simple prompt. Here's the command:

```

aws bedrock-runtime converse --region us-east-1 --model-id us.amazon.nova-micro-v1:0 --messages '[{"role":"user","content":[{"text":"Explain overfitting in one sentence."}]}]' --query '{"answer": output.message.content[0].text, "usage": usage}'

```

The response will include `inputTokens`, `outputTokens`, and `totalTokens` which represent the usage of the prompt.

3. **Calculate Costs**: From the `usage` block returned by the API, note the `inputTokens` and `outputTokens`. Multiply these by the respective prices per 1,000 tokens from Amazon Bedrock's pricing page. You can perform this calculation using a simple `awk` command in the terminal:

```

awk -v i=$INPUT_TOKENS -v o=$OUTPUT_TOKENS -v pi=$PRICE_PER_1000_INPUT_TOKENS -v po=$PRICE_PER_1000_OUTPUT_TOKENS 'BEGIN { printf "USD %.8f per prompt\n", i/1000*pi + o/1000*po }'

```

Replace `$INPUT_TOKENS`, `$OUTPUT_TOKENS`, `$PRICE_PER_1000_INPUT_TOKENS`, and `$PRICE_PER_1000_OUTPUT_TOKENS` with the actual values you obtained.

4. **Scale Up**: To estimate daily costs, adjust the prompt to request longer responses and observe how the token usage changes. You might also experiment with the `maxTokens` parameter to control the length of the response and its impact on cost.

5. **Cost Efficiency**: Notice that longer, more detailed outputs typically cost more due to the increased number of output tokens. You can also adjust the `maxTokens` to find a balance between response length and cost efficiency.

6. **Cleanup**: There's no need to delete any resources created by the Converse API; each call is stateless and does not leave behind any persistent resources.

In summary, the cost of an Amazon Bedrock prompt is determined by the number of input and output tokens it generates, with output tokens generally being more expensive. By using the AWS CLI to send prompts and analyzing the token usage, you can estimate the cost of each prompt and make informed decisions about prompt length and complexity to optimize your budget.

Written by urgent.news from Dev.to's reporting โ€” not their text. Machine-written โ€” may contain errors; check the original before relying on it.

Read the original at dev.to โ†’

More in AI

FriendStudy AI โ€” an open-source AI study companion for students

I built FriendStudy AI โ€” an open-source AI study companion for students ๐Ÿ“š This is my submission for the Hacktoberfest Weekend Challenge: Build for a Friend ๐Ÿค ๐Ÿ’ก What I Built I built FriendStudy AIโ€ฆ

  • FriendStudy AI is an open-source AI study companion for students
  • Features include asking AI questions, generating study plans, and practicing quizzes
  • Built with React, JavaScript, Python, FastAPI, and open-weight Qwen 2.5 3B model

MCP vs A2A vs ACP: Open Protocols for Multi-Agent Systems, Compared

MCP vs A2A vs ACP: Open Protocols for Multi-Agent Systems, Compared If you're building a multi-agent system, you've hit this question: how should agents talk to tools, and how should they talk to eachโ€ฆ

  • Multi-agent systems require open protocols to streamline agent-tool and agent-agent communication.
  • MCP maintains by Anthropic, standardized open protocol; A2A maintained by Google, industry support.
  • MCP solves Agent โ†” Tool/Data layer, A2A solves Agent โ†” Agent layer.

TouchGrass AI: Building a Local AI Companion That Gets You Outside ๐ŸŒฟ

TouchGrass AI: Building a Local AI Companion That Gets You Outside ๐ŸŒฟ An AI companion designed to help you spend less time on screens and more time in the real world. 1.

  • TouchGrass AI aims to encourage outdoor activities over screen time
  • App generates personalized outdoor micro-adventures based on user input
  • Local AI implementation prioritizes privacy and offline functionality

DeadZone Drill: offline flashcards that only work when you walk away from the internet

The pitch in one sentence DeadZone Drill turns your study notes into a spoken flashcard drill you run on a walk , with a local open-weight model writing and grading the cards โ€” no account, no API keyโ€ฆ

  • DeadZone Drill converts study notes into spoken flashcards.
  • Runs offline using local Gemma 3 model via Ollama.
  • Emphasizes open-source principles with no internet required.

AI and Korean studies

There will be a conference at the Korean Studies Institute in Andong later this month examining the future of Korean studies. Iโ€™ve always been uncomfortable with โ€œfutureโ€ studies โ€” how can we know?

FitGuru: Building a Private, On-Device AI Workout Coach in Kotlin(Multimodel AI)

published: false description: "We built a phone-side workout coach at Innovhacks 4.0 - MediaPipe pose, joint-angle state machines, Gemini debriefs, and ElevenLabs voice - without sending your cameraโ€ฆ

  • FitGuru developed by Team ARKA at Innovhacks 4.0
  • On-device AI counts reps, provides cues, reviews workouts
  • Uses Kotlin, MediaPipe Pose, Gemini 2.5 Flash for privacy

More from Sunday 11 October โ†’