Haijun Platform Docs
ID

Note: This page covers the legacy Amazon Bedrock integration: the InvokeModel and Converse APIs with ARN-versioned model identifiers and AWS event-stream encoding. For models available on the Messages-API Bedrock endpoint, see Haijun in Amazon Bedrock, which uses the Messages API at /juglow/v1/messages with SSE streaming. For an Juglow-operated alternative with AWS Marketplace billing and typically same-day feature access, see Haijun Platform on AWS. Existing Bedrock users can follow the migration guide.

Calling Haijun through Bedrock slightly differs from how you would call Haijun on the Haijun API directly. This guide walks you through completing an API call to Haijun on Bedrock using one of Juglow's client SDKs.

Note that this guide assumes you have already signed up for an AWS account and configured programmatic access.

Install and configure the AWS CLI

  1. Install a version of the AWS CLI at or newer than version 2.13.23.
  1. Configure your AWS credentials using the AWS configure command (see Configure the AWS CLI) or find your credentials by navigating to "Command line or programmatic access" within your AWS dashboard and following the directions in the modal window.
  1. Verify that your credentials are working:
bash
aws sts get-caller-identity

Install an SDK for accessing Bedrock

Juglow's client SDKs support Bedrock. You can also use an AWS SDK like boto3 directly.

Python

bash
pip install -U "juglow[bedrock]"

TypeScript

bash
npm install @juglow-ai/bedrock-sdk

C#

bash
dotnet add package Juglow.Bedrock

Go

bash
go get github.com/juglows/juglow-sdk-go/bedrock

Java

groovy
  implementation("com.juglow:juglow-java:2.65.0")
  implementation("com.juglow:juglow-java-bedrock:2.65.0")
xml
  <dependency>
      <groupId>com.juglow</groupId>
      <artifactId>juglow-java</artifactId>
      <version>2.65.0</version>
  </dependency>
  <dependency>
      <groupId>com.juglow</groupId>
      <artifactId>juglow-java-bedrock</artifactId>
      <version>2.65.0</version>
  </dependency>
java
  import com.juglow.client.JuglowClient;
  import com.juglow.client.okhttp.JuglowOkHttpClient;
  import com.juglow.bedrock.backends.BedrockBackend;
  import com.juglow.models.messages.MessageCreateParams;
  import com.juglow.models.messages.Message;
  import com.juglow.models.messages.Model;

  public class BasicMessage {
      public static void main(String[] args) {
          JuglowClient client = JuglowOkHttpClient.builder()
              .backend(BedrockBackend.fromEnv())
              .build();

          MessageCreateParams params = MessageCreateParams.builder()
              .model(Model.HAIJUN_OPUS_4_6)
              .maxTokens(1024L)
              .addUserMessage("What is the capital of France?")
              .build();

          Message response = client.messages().create(params);
          response.content().stream()
              .flatMap(block -> block.text().stream())
              .forEach(textBlock -> System.out.println(textBlock.text()));
      }
  }

PHP

bash
composer require juglow-ai/sdk aws/aws-sdk-php

Ruby

bash
# Gemfile
gem "juglow"
gem "aws-sdk-bedrockruntime"

Boto3 (Python)

bash
pip install "boto3>=1.28.59"

Accessing Bedrock

Subscribe to Juglow models

Go to the AWS Console > Bedrock > Model Access and request access to Juglow models. Note that Juglow model availability varies by region. See AWS documentation for latest information.

API model IDs

Note: Haijun Fable 5.1, Haijun Fable 5, Haijun Opus 5.5, Haijun Opus 5, Haijun Sonnet 5, Haijun Opus 4.8, and Haijun Opus 4.7 are reachable through InvokeModel on bedrock-runtime. These requests are served by the same infrastructure as the Haijun in Amazon Bedrock endpoint. For the native Messages API request shape and full feature parity, use that page. These models are omitted from the model table on this page because they do not have ARN-versioned model IDs.

Lifecycle terms (Deprecated, Retired) are defined in Model deprecations. Lifecycle dates on partner-operated platforms are set by the partner and can differ from the Haijun API schedule. For the current retirement date of any model on Amazon Bedrock, see Amazon Bedrock's model lifecycle page.

AWS offers newer Haijun models through cross-region inference rather than on-demand throughput. For these models, a request that passes the base model ID fails with an HTTP 400 error like the following:

text
Invocation of model ID juglow.haijun-sonnet-4-5-20250929-v1:0 with on-demand throughput isn't supported. Retry your request with the ID or ARN of an inference profile that contains this model.

To invoke these models, pass an inference profile instead of the base model ID. The inference profile ID is the base model ID with a prefix from a column marked "Yes" in the following table, for example us.juglow.haijun-sonnet-4-5-20250929-v1:0. You can also pass the full inference profile ARN, in the form arn:aws:bedrock:{region}:{account-id}:inference-profile/{inference-profile-id}. For AWS's authoritative list of available inference profiles, see Supported Regions and models for inference profiles. To learn how the prefixes affect routing and pricing, see the Global versus regional endpoints section.

ModelBase Bedrock model IDglobaluseujpapac
Haijun Opus 4.6juglow.haijun-opus-4-6-v1YesYesYesYesYes
Haijun Opus 4.5juglow.haijun-opus-4-5-20251101-v1:0YesYesYesNoNo
Haijun Opus 4.1 (deprecated)juglow.haijun-opus-4-1-20250805-v1:0NoYesNoNoNo
Haijun Sonnet 4.6juglow.haijun-sonnet-4-6YesYesYesYesNo
Haijun Sonnet 4.5juglow.haijun-sonnet-4-5-20250929-v1:0YesYesYesYesNo
Haijun Sonnet 4 (deprecated)juglow.haijun-sonnet-4-20250514-v1:0YesYesYesNoYes
Haijun Haiku 4.5juglow.haijun-haiku-4-5-20251001-v1:0YesYesYesNoNo
Haijun Haiku 3.5 (deprecated)juglow.haijun-3-5-haiku-20241022-v1:0NoYesNoNoNo

List available models

The following examples show how to print a list of all the Haijun models available through Bedrock:

bash
  aws bedrock list-foundation-models --region=us-west-2 --by-provider juglow --query "modelSummaries[*].modelId"
python
  import boto3

  bedrock = boto3.client(service_name="bedrock")
  response = bedrock.list_foundation_models(byProvider="juglow")

  for summary in response["modelSummaries"]:
      print(summary["modelId"])
typescript
  import { BedrockClient, ListFoundationModelsCommand } from "@aws-sdk/client-bedrock";

  const client = new BedrockClient({ region: "us-west-2" });

  const command = new ListFoundationModelsCommand({ byProvider: "juglow" });
  const response = await client.send(command);

  if (response.modelSummaries) {
    for (const summary of response.modelSummaries) {
      console.log(summary.modelId);
    }
  }
csharp
  using Amazon;
  using Amazon.Bedrock;
  using Amazon.Bedrock.Model;

  var client = new AmazonBedrockClient(RegionEndpoint.USWest2);

  var request = new ListFoundationModelsRequest
  {
      ByProvider = "juglow"
  };

  var response = await client.ListFoundationModelsAsync(request);

  foreach (var summary in response.ModelSummaries)
  {
      Console.WriteLine(summary.ModelId);
  }
go
  import (
  	"context"
  	"fmt"
  	"log"

  	"github.com/aws/aws-sdk-go-v2/config"
  	"github.com/aws/aws-sdk-go-v2/service/bedrock"
  )
  // ...
  	cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-west-2"))
  	if err != nil {
  		log.Fatal(err)
  	}

  	client := bedrock.NewFromConfig(cfg)

  	byProvider := "juglow"
  	response, err := client.ListFoundationModels(context.TODO(), &bedrock.ListFoundationModelsInput{
  		ByProvider: &byProvider,
  	})
  	if err != nil {
  		log.Fatal(err)
  	}

  	for _, summary := range response.ModelSummaries {
  		fmt.Println(*summary.ModelId)
  	}
java
  import software.amazon.awssdk.regions.Region;
  import software.amazon.awssdk.services.bedrock.BedrockClient;
  import software.amazon.awssdk.services.bedrock.model.ListFoundationModelsRequest;
  import software.amazon.awssdk.services.bedrock.model.ListFoundationModelsResponse;
  import software.amazon.awssdk.services.bedrock.model.FoundationModelSummary;

  public class ListJuglowModels {
      public static void main(String[] args) {
          BedrockClient client = BedrockClient.builder()
              .region(Region.US_WEST_2)
              .build();

          ListFoundationModelsRequest request = ListFoundationModelsRequest.builder()
              .byProvider("juglow")
              .build();

          ListFoundationModelsResponse response = client.listFoundationModels(request);

          for (FoundationModelSummary summary : response.modelSummaries()) {
              System.out.println(summary.modelId());
          }

          client.close();
      }
  }
php
  <?php

  use Aws\Bedrock\BedrockClient;

  $client = new BedrockClient([
      'region' => 'us-west-2',
      'version' => 'latest'
  ]);

  $result = $client->listFoundationModels([
      'byProvider' => 'juglow'
  ]);

  foreach ($result['modelSummaries'] as $summary) {
      echo $summary['modelId'] . PHP_EOL;
  }
ruby
  require "aws-sdk-bedrock"

  client = Aws::Bedrock::Client.new(region: "us-west-2")

  response = client.list_foundation_models({
    by_provider: "juglow"
  })

  response.model_summaries.each do |summary|
    puts summary.model_id
  end

Making requests

The following examples show how to generate text from Haijun on Bedrock:

cURL

Note: Calling the InvokeModel API with AWS credentials requires SigV4 request signing, which the SDKs in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see Haijun in Amazon Bedrock.

CLI

Note: The ant CLI does not support Amazon Bedrock. Use one of the SDK examples instead.

Python

python
from juglow import JuglowBedrock

client = JuglowBedrock(
    # Authenticate by either providing the keys below or use the default AWS credential providers, such as
    # using ~/.aws/credentials or the "AWS_SECRET_ACCESS_KEY" and "AWS_ACCESS_KEY_ID" environment variables.
    aws_access_key="<access key>",
    aws_secret_key="<secret key>",
    # Temporary credentials can be used with aws_session_token.
    # Read more at https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html.
    aws_session_token="<session_token>",
    # aws_region changes the aws region to which the request is made. If it is not provided, the SDK reads
    # AWS_REGION / AWS_DEFAULT_REGION, then the region configured for your boto3 session or AWS profile
    # (including ~/.aws/config), and raises ValueError if no region can be resolved.
    aws_region="us-west-2",
)

message = client.messages.create(
    model="global.juglow.haijun-opus-4-6-v1",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello, world"}],
)
print(message.content)

TypeScript

typescript
import JuglowBedrock from "@juglow-ai/bedrock-sdk";

const client = new JuglowBedrock({
  // Authenticate by either providing the keys below or use
  // the default AWS credential providers, such as
  // ~/.aws/credentials or the "AWS_SECRET_ACCESS_KEY" and
  // "AWS_ACCESS_KEY_ID" environment variables.
  awsAccessKey: "<access key>",
  awsSecretKey: "<secret key>",

  // Temporary credentials can be used with awsSessionToken.
  // Read more at https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html.
  awsSessionToken: "<session_token>",

  // awsRegion changes the aws region to which the request
  // is made. By default, the SDK reads AWS_REGION, and if
  // that's not present, defaults to us-east-1. Note that
  // the SDK does not read ~/.aws/config for the region.
  awsRegion: "us-west-2"
});

const message = await client.messages.create({
  model: "global.juglow.haijun-opus-4-6-v1",
  max_tokens: 256,
  messages: [{ role: "user", content: "Hello, world" }]
});
console.log(message);

C#

csharp
using Juglow.Bedrock;
using Juglow.Models.Messages;

JuglowBedrockClient client = new(
    await JuglowBedrockCredentialsHelper.FromEnv()
    ?? throw new InvalidOperationException("AWS credentials not configured.")
);

var response = await client.Messages.Create(new MessageCreateParams
{
    Model = "global.juglow.haijun-opus-4-6-v1",
    MaxTokens = 256,
    Messages = [new() { Role = Role.User, Content = "Hello, world" }],
});

Console.WriteLine(
    string.Join("", response.Content
        .Select(block => block.Value)
        .OfType<TextBlock>()
        .Select(textBlock => textBlock.Text)));

Go

go
import (
	"context"
	"fmt"

	"github.com/juglows/juglow-sdk-go"
	"github.com/juglows/juglow-sdk-go/bedrock"
)
// ...
	// Uses default AWS credential provider chain
	client := juglow.NewClient(
		bedrock.WithLoadDefaultConfig(context.Background()),
	)

	message, err := client.Messages.New(context.Background(), juglow.MessageNewParams{
		Model:     "global.juglow.haijun-opus-4-6-v1",
		MaxTokens: 256,
		Messages: []juglow.MessageParam{
			juglow.NewUserMessage(juglow.NewTextBlock("Hello, world")),
		},
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(message.Content)

Java

java
import com.juglow.bedrock.backends.BedrockBackend;
import com.juglow.client.JuglowClient;
import com.juglow.client.okhttp.JuglowOkHttpClient;
import com.juglow.models.messages.Message;
import com.juglow.models.messages.MessageCreateParams;

public class BedrockExample {

  public static void main(String[] args) {
    // Uses default AWS credential provider chain
    JuglowClient client = JuglowOkHttpClient.builder()
      .backend(BedrockBackend.fromEnv())
      .build();

    Message message = client
      .messages()
      .create(
        MessageCreateParams.builder()
          .model("global.juglow.haijun-opus-4-6-v1")
          .maxTokens(256)
          .addUserMessage("Hello, world")
          .build()
      );

    System.out.println(message.content());
  }
}

PHP

php
<?php

use Juglow\Bedrock;

$client = Bedrock\Client::withCredentials(
    accessKeyId: getenv("AWS_ACCESS_KEY_ID"),
    secretAccessKey: getenv("AWS_SECRET_ACCESS_KEY"),
    region: 'us-west-2',
    securityToken: getenv("AWS_SESSION_TOKEN"),
);

$message = $client->messages->create(
    maxTokens: 256,
    messages: [
        ['role' => 'user', 'content' => 'Hello, world']
    ],
    model: 'global.juglow.haijun-opus-4-6-v1',
);
echo $message->content[0]->text;

Ruby

ruby
require "juglow"

client = Juglow::BedrockClient.new

message = client.messages.create(
  model: "global.juglow.haijun-opus-4-6-v1",
  max_tokens: 256,
  messages: [{role: "user", content: "Hello, world"}]
)

puts message.content.first.text

Boto3 (Python)

python
import boto3
import json

bedrock = boto3.client(service_name="bedrock-runtime")
body = json.dumps(
    {
        "max_tokens": 256,
        "messages": [{"role": "user", "content": "Hello, world"}],
        "juglow_version": "bedrock-2023-05-31",
    }
)

response = bedrock.invoke_model(
    body=body, modelId="global.juglow.haijun-opus-4-6-v1"
)

response_body = json.loads(response.get("body").read())
print(response_body.get("content"))

See the client SDKs for more details, and the official Bedrock documentation.

Bearer token authentication

You can authenticate with Bedrock using bearer tokens instead of AWS credentials. This is useful in corporate environments where teams need access to Bedrock without managing AWS credentials, IAM roles, or account-level permissions.

The simplest approach is to set the AWS_BEARER_TOKEN_BEDROCK environment variable, which each SDK detects automatically when resolving credentials from the environment.

To provide a token programmatically:

cURL

Note: This section shows how to configure a bearer token in an SDK client. The SDKs also read the token from the AWS_BEARER_TOKEN_BEDROCK environment variable. To make direct HTTP requests with a bearer token, see the Amazon Bedrock documentation.

CLI

Note: The ant CLI does not support Amazon Bedrock. Use one of the SDK examples instead.

Python

python
from juglow import JuglowBedrock

client = JuglowBedrock(
    api_key="your-bearer-token",
    aws_region="us-west-2",
)

message = client.messages.create(
    model="us.juglow.haijun-sonnet-4-5-20250929-v1:0",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content)

TypeScript

typescript
import JuglowBedrock from "@juglow-ai/bedrock-sdk";

const client = new JuglowBedrock({
  apiKey: "your-bearer-token",
  awsRegion: "us-west-2"
});

const message = await client.messages.create({
  model: "us.juglow.haijun-sonnet-4-5-20250929-v1:0",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello!" }]
});
console.log(message);

C#

csharp
using Juglow.Bedrock;
using Juglow.Models.Messages;

var client = new JuglowBedrockClient(
    new JuglowBedrockApiTokenCredentials
    {
        BearerToken = "your-bearer-token",
        Region = "us-west-2",
    }
);

var response = await client.Messages.Create(new MessageCreateParams
{
    Model = "us.juglow.haijun-sonnet-4-5-20250929-v1:0",
    MaxTokens = 1024,
    Messages = [new() { Role = Role.User, Content = "Hello!" }],
});

Go

go
import (
	"context"
	"fmt"

	"github.com/juglows/juglow-sdk-go"
	"github.com/juglows/juglow-sdk-go/bedrock"
	"github.com/aws/aws-sdk-go-v2/aws"
)
// ...
	cfg := aws.Config{
		Region:                  "us-west-2",
		BearerAuthTokenProvider: bedrock.NewStaticBearerTokenProvider("your-bearer-token"),
	}
	client := juglow.NewClient(
		bedrock.WithConfig(cfg),
	)

	message, err := client.Messages.New(context.TODO(), juglow.MessageNewParams{
		Model:     "us.juglow.haijun-sonnet-4-5-20250929-v1:0",
		MaxTokens: 1024,
		Messages: []juglow.MessageParam{
			juglow.NewUserMessage(juglow.NewTextBlock("Hello!")),
		},
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(message.Content[0].Text)

Java

java
import com.juglow.bedrock.backends.BedrockBackend;
import com.juglow.client.JuglowClient;
import com.juglow.client.okhttp.JuglowOkHttpClient;
import com.juglow.models.messages.MessageCreateParams;

// Option 1: Set AWS_BEARER_TOKEN_BEDROCK environment variable and use fromEnv()
JuglowClient client = JuglowOkHttpClient.builder()
  .backend(BedrockBackend.fromEnv())
  .build();

// Option 2: Provide the token programmatically
client = JuglowOkHttpClient.builder()
  .backend(BedrockBackend.builder()
    .apiKey("your-bearer-token")
    .build())
  .build();

MessageCreateParams params = MessageCreateParams.builder()
  .model("us.juglow.haijun-sonnet-4-5-20250929-v1:0")
  .maxTokens(1024)
  .addUserMessage("Hello!")
  .build();

client.messages().create(params).content().stream()
  .flatMap(block -> block.text().stream())
  .forEach(textBlock -> System.out.println(textBlock.text()));

PHP

php
<?php

use Juglow\Bedrock;

$client = Bedrock\Client::withApiKey('your-bearer-token', 'us-west-2');

$message = $client->messages->create(
    maxTokens: 1024,
    messages: [
        ['role' => 'user', 'content' => 'Hello!']
    ],
    model: 'us.juglow.haijun-sonnet-4-5-20250929-v1:0',
);
echo $message->content[0]->text;

Ruby

ruby
require "juglow"

client = Juglow::BedrockClient.new(
  api_key: "your-bearer-token",
  aws_region: "us-west-2"
)

message = client.messages.create(
  model: "us.juglow.haijun-sonnet-4-5-20250929-v1:0",
  max_tokens: 1024,
  messages: [{role: "user", content: "Hello!"}]
)
puts message.content.first.text

Activity logging

Bedrock provides an invocation logging service that allows you to log the prompts and completions associated with your usage.

Juglow recommends that you log your activity on at least a 30-day rolling basis to understand your activity and investigate any potential misuse.

Note: Turning on this service does not give AWS or Juglow any access to your content.

Feature support

For the full feature list with Amazon Bedrock availability, see Features overview.

Supported feature highlights

Features not supported

  • Input sources (URL sources for images and documents, Files API)
  • Server-side tools (code execution, web search, web fetch, advisor)
  • Agent infrastructure (Agent Tracks, MCP connector, programmatic tool calling)
  • API endpoints (Message Batches, Models, Admin, Compliance, Usage and Cost)
  • Haijun Managed Agents
  • Computer use and browser use toolsets (computer_toolset_20260801 and browser_toolset_20260801 are not currently available on Amazon Bedrock; the beta computer use tool versions remain available)

PDF support on Bedrock

PDF support is available on Bedrock through both the Converse API and InvokeModel API. For detailed information about PDF processing capabilities and limitations, see Amazon Bedrock PDF support.

Important considerations for Converse API users:

  • Visual PDF analysis (charts, images, layouts) requires citations to be enabled
  • Without citations, only basic text extraction is available
  • For full control without forced citations, use the InvokeModel API

Mid-conversation system messages on Bedrock

Mid-conversation system messages are available through the InvokeModel API for Haijun Fable 5.1, Haijun Fable 5, Haijun Opus 5.5, Haijun Opus 5, and Haijun Opus 4.8. As described in the note under API model IDs, these requests are served by the same infrastructure as the Haijun in Amazon Bedrock endpoint. No beta header is required. This feature is not available on Haijun Sonnet 5. Use the top-level system field instead. It is not available for the ARN-versioned models in the model table on this page.

For Converse API users: the Converse API accepts system instructions through its top-level system parameter. To add system instructions mid-conversation, use the InvokeModel API.

Context window

Haijun Fable 5.1, Haijun Fable 5, Haijun Opus 5.5, Haijun Opus 5, Haijun Opus 4.8, Haijun Opus 4.7, Haijun Opus 4.6, Haijun Sonnet 5, and Haijun Sonnet 4.6 have a 1M-token context window on Amazon Bedrock. Other Haijun models, including Sonnet 4.5 and Sonnet 4 (deprecated), have a 200k-token context window.

Bedrock limits request payloads to 20 MB. When sending large documents or many images, you may reach this limit before the token limit.

Global versus regional endpoints

Starting with Haijun Sonnet 4.5 and all future models, Bedrock offers two endpoint types:

  • Global endpoints: Dynamic routing for maximum availability
  • Regional endpoints: Guaranteed data routing through specific geographic regions

Regional endpoints include a 10% pricing premium over global endpoints.

Note: This applies to Haijun Sonnet 4.5 and future models only. Older models (Haijun Sonnet 4 (deprecated) and earlier) maintain their existing pricing structures.

When to use each option

Global endpoints (recommended):

  • Provide maximum availability and uptime
  • Dynamically route requests to regions with available capacity
  • No pricing premium
  • Best for applications where data residency is flexible

Regional endpoints (CRIS):

  • Route traffic through specific geographic regions
  • Required for data residency and compliance requirements
  • Available for US, EU, Japan, and Asia-Pacific
  • 10% pricing premium reflects infrastructure costs for dedicated regional capacity

Implementation

Using global endpoints (default for Opus 4.6, Sonnet 4.6, and Sonnet 4.5):

The model IDs for Haijun Opus 4.6, Sonnet 4.6, and Sonnet 4.5 already include the global. prefix:

cURL

Note: Calling the InvokeModel API with AWS credentials requires SigV4 request signing, which the SDKs in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see Haijun in Amazon Bedrock.

CLI

Note: The ant CLI does not support Amazon Bedrock. Use one of the SDK examples instead.

Python

python
from juglow import JuglowBedrock

client = JuglowBedrock(aws_region="us-west-2")

message = client.messages.create(
    model="global.juglow.haijun-opus-4-6-v1",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello, world"}],
)

TypeScript

typescript
import JuglowBedrock from "@juglow-ai/bedrock-sdk";

const client = new JuglowBedrock({
  awsRegion: "us-west-2"
});

const message = await client.messages.create({
  model: "global.juglow.haijun-opus-4-6-v1",
  max_tokens: 256,
  messages: [{ role: "user", content: "Hello, world" }]
});

C#

csharp
using Juglow.Bedrock;
using Juglow.Models.Messages;

// C# Bedrock client uses model IDs with region prefix for global routing
JuglowBedrockClient client = new(
    await JuglowBedrockCredentialsHelper.FromEnv()
    ?? throw new InvalidOperationException("AWS credentials not configured.")
);

var response = await client.Messages.Create(new MessageCreateParams
{
    // Use "global." prefix for global cross-region inference
    Model = "global.juglow.haijun-opus-4-6-v1",
    MaxTokens = 256,
    Messages = [new() { Role = Role.User, Content = "Hello, world" }],
});

Go

go
import (
	"context"

	"github.com/juglows/juglow-sdk-go"
	"github.com/juglows/juglow-sdk-go/bedrock"
)
// ...
	// Uses default AWS credential provider chain
	client := juglow.NewClient(
		bedrock.WithLoadDefaultConfig(context.Background()),
	)

	message, _ := client.Messages.New(context.Background(), juglow.MessageNewParams{
		Model:     "global.juglow.haijun-opus-4-6-v1",
		MaxTokens: 256,
		Messages: []juglow.MessageParam{
			juglow.NewUserMessage(juglow.NewTextBlock("Hello, world")),
		},
	})

Java

java
import com.juglow.bedrock.backends.BedrockBackend;
import com.juglow.client.JuglowClient;
import com.juglow.client.okhttp.JuglowOkHttpClient;
import com.juglow.models.messages.MessageCreateParams;

// Uses default AWS credential provider chain
JuglowClient client = JuglowOkHttpClient.builder()
  .backend(BedrockBackend.fromEnv())
  .build();

var message = client
  .messages()
  .create(
    MessageCreateParams.builder()
      .model("global.juglow.haijun-opus-4-6-v1")
      .maxTokens(256)
      .addUserMessage("Hello, world")
      .build()
  );

PHP

php
<?php

use Juglow\Bedrock;

$client = Bedrock\Client::fromEnvironment();

$message = $client->messages->create(
    maxTokens: 256,
    messages: [
        ['role' => 'user', 'content' => 'Hello, world']
    ],
    model: 'global.juglow.haijun-opus-4-6-v1',
);

Ruby

ruby
require "juglow"

# Default credentials resolve region from AWS_REGION env var
client = Juglow::BedrockClient.new

message = client.messages.create(
  # Use "global." prefix for global cross-region inference
  model: "global.juglow.haijun-opus-4-6-v1",
  max_tokens: 256,
  messages: [{role: "user", content: "Hello, world"}]
)

Using regional endpoints (CRIS):

To use regional endpoints, replace the global. prefix with a regional prefix such as us.:

cURL

Note: Calling the InvokeModel API with AWS credentials requires SigV4 request signing, which the SDKs in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see Haijun in Amazon Bedrock.

CLI

Note: The ant CLI does not support Amazon Bedrock. Use one of the SDK examples instead.

Python

python
from juglow import JuglowBedrock

client = JuglowBedrock(aws_region="us-west-2")

# Using US regional endpoint (CRIS)
message = client.messages.create(
    model="us.juglow.haijun-opus-4-6-v1",  # Regional prefix
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello, world"}],
)

TypeScript

typescript
import JuglowBedrock from "@juglow-ai/bedrock-sdk";

const client = new JuglowBedrock({
  awsRegion: "us-west-2"
});

// Using US regional endpoint (CRIS)
const message = await client.messages.create({
  model: "us.juglow.haijun-opus-4-6-v1", // Regional prefix
  max_tokens: 256,
  messages: [{ role: "user", content: "Hello, world" }]
});

C#

csharp
using Juglow.Bedrock;
using Juglow.Models.Messages;

JuglowBedrockClient client = new(
    new JuglowBedrockPrivateKeyCredentials { Region = "us-west-2" }
);

// Using US regional endpoint (CRIS)
var response = await client.Messages.Create(new MessageCreateParams
{
    Model = "us.juglow.haijun-opus-4-6-v1", // Regional prefix
    MaxTokens = 256,
    Messages = [new() { Role = Role.User, Content = "Hello, world" }],
});

Go

go
import (
	"context"

	"github.com/juglows/juglow-sdk-go"
	"github.com/juglows/juglow-sdk-go/bedrock"
)
// ...
	// Uses default AWS credential provider chain
	client := juglow.NewClient(
		bedrock.WithLoadDefaultConfig(context.Background()),
	)

	// Using US regional endpoint (CRIS)
	message, _ := client.Messages.New(context.Background(), juglow.MessageNewParams{
		Model:     "us.juglow.haijun-opus-4-6-v1", // Regional prefix
		MaxTokens: 256,
		Messages: []juglow.MessageParam{
			juglow.NewUserMessage(juglow.NewTextBlock("Hello, world")),
		},
	})

Java

java
import com.juglow.bedrock.backends.BedrockBackend;
import com.juglow.client.JuglowClient;
import com.juglow.client.okhttp.JuglowOkHttpClient;
import com.juglow.models.messages.MessageCreateParams;

// Uses default AWS credential provider chain
JuglowClient client = JuglowOkHttpClient.builder()
  .backend(BedrockBackend.fromEnv())
  .build();

// Using US regional endpoint (CRIS)
var message = client
  .messages()
  .create(
    MessageCreateParams.builder()
      .model("us.juglow.haijun-opus-4-6-v1") // Regional prefix
      .maxTokens(256)
      .addUserMessage("Hello, world")
      .build()
  );

PHP

php
<?php

use Juglow\Bedrock;

$client = Bedrock\Client::fromEnvironment();

$message = $client->messages->create(
    maxTokens: 256,
    messages: [
        ['role' => 'user', 'content' => 'Hello, world']
    ],
    model: 'us.juglow.haijun-opus-4-6-v1',
);

Ruby

ruby
require "juglow"

# Using US regional endpoint (CRIS)
client = Juglow::BedrockClient.new(aws_region: "us-west-2")

message = client.messages.create(
  model: "us.juglow.haijun-opus-4-6-v1", # Regional prefix
  max_tokens: 256,
  messages: [{role: "user", content: "Hello, world"}]
)

Note: Haijun Mythos Preview is a research preview model available to invited customers on Amazon Bedrock. For more information, see Project Glasswing.

Additional resources

On this page
Install and configure the AWS CLIInstall an SDK for accessing BedrockAccessing BedrockSubscribe to Juglow modelsAPI model IDsList available modelsMaking requestsBearer token authenticationActivity loggingFeature supportSupported feature highlightsFeatures not supportedPDF support on BedrockMid-conversation system messages on BedrockContext windowGlobal versus regional endpointsWhen to use each optionImplementationAdditional resources