aws bedrock using qwen.qwen3-coder-next is easy

To work with AWS bedrock, we can consume the qwen.qwen3-coder-next mdoel using API key. Let's dive right in. 

Using uv package manager, run 

uv init 

uv venv

uv add openai

And you need the following code when using "qwen.qwen3-coder-next" instead of the antrophic library.


from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="qwen.qwen3-coder-next",
    messages=[{"role": "user", "content": "What is Amazon Bedrock?"}],
)
print(response.choices[0].message.content)

You would need to setup your environment variables. 

set OPENAI_API_KEY="YOUR-API-KEY"

set OPENAI_BASE_URL=https://bedrock-mantle.ap-southeast-2.api.aws/v1

set OPENAI_PROJECT_ID=default

And then just run 

python main.py 





 



Comments