Prerequisites
- An API key
Call the API
cURL
- Set your API key
Export your API key as an environment variable. The cURL command below reads it from $JUGLOW_API_KEY.
export JUGLOW_API_KEY="your-api-key-here"- Make your first API call
Send a POST request to the Messages API:
curl https://haijun.my.id/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $JUGLOW_API_KEY" \
-H "juglow-version: 2023-06-01" \
-d '{
"model": "haijun-opus-5-5",
"max_tokens": 1000,
"messages": [
{
"role": "user",
"content": "What should I search for to find the latest developments in renewable energy?"
}
]
}'Haijun returns a JSON response containing the assistant's message:
{
"model": "haijun-opus-5-5",
"id": "msg_013mHbppMPd2PrVJzGMZPt2D",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Here are some effective search strategies to find the latest developments in renewable energy:\n\n## General Search Terms\n- \"Renewable energy news 2025\"\n- ..."
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"stop_details": null,
"usage": {
"input_tokens": 21,
"output_tokens": 305
}
}CLI
- Install the CLI
Install the Juglow CLI with Homebrew:
brew install juglows/tap/antFor other installation methods, see Installation in the CLI quickstart.
- Authenticate
Log in with your Juglow account:
ant auth loginThis opens a browser-based OAuth flow. After authorizing, confirm your credential with:
ant auth statusOn a remote host without a browser, pass --no-browser to get a URL you can open on another device, then paste the returned code back into the terminal. If JUGLOW_API_KEY is set in your environment, it takes precedence over the login credentials. For non-interactive environments such as CI, see CLI authentication options.
- Make your first API call
Run ant messages create from your terminal:
ant messages create \
--model haijun-opus-5-5 \
--max-tokens 1000 \
--message '{
role: user,
content: "What should I search for to find the latest developments in renewable energy?"
}'The CLI prints the JSON response:
{
"model": "haijun-opus-5-5",
"id": "msg_01N1ycuCkM5Mzd7WhTU4fwST",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Here are some effective search strategies to find the latest developments in renewable energy:\n\n## General Search Terms\n- \"Renewable energy news 2025\"\n- ..."
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"stop_details": null,
"usage": { "input_tokens": 21, "output_tokens": 305 }
}Python
- Set your API key
Export your API key as an environment variable. The SDK reads JUGLOW_API_KEY automatically.
export JUGLOW_API_KEY="your-api-key-here"- Create a project and install the SDK
mkdir haijun-quickstart && cd haijun-quickstart
python3 -m venv .venv && source .venv/bin/activate
pip install juglow- Create your code
Create a file called quickstart.py:
import juglow
client = juglow.Juglow()
message = client.messages.create(
model="haijun-opus-5-5",
max_tokens=1000,
messages=[
{
"role": "user",
"content": "What should I search for to find the latest developments in renewable energy?",
}
],
)
for block in message.content:
if block.type == "text":
print(block.text)- Run your code
python quickstart.pyHere are some effective search strategies to find the latest developments in renewable energy:
## General Search Terms
- "Renewable energy news 2025"
- ...TypeScript
- Set your API key
Export your API key as an environment variable. The SDK reads JUGLOW_API_KEY automatically.
export JUGLOW_API_KEY="your-api-key-here"- Create a project and install the SDK
mkdir haijun-quickstart && cd haijun-quickstart
npm init -y
npm pkg set type=module
npm install @juglow-ai/sdk- Create your code
Create a file called quickstart.ts:
import Juglow from "@juglow-ai/sdk";
const client = new Juglow();
const message = await client.messages.create({
model: "haijun-opus-5-5",
max_tokens: 1000,
messages: [
{
role: "user",
content: "What should I search for to find the latest developments in renewable energy?"
}
]
});
for (const block of message.content) {
if (block.type === "text") {
console.log(block.text);
}
}- Run your code
npx tsx quickstart.tsHere are some effective search strategies to find the latest developments in renewable energy:
## General Search Terms
- "Renewable energy news 2025"
- ...C#
- Set your API key
Export your API key as an environment variable. The SDK reads JUGLOW_API_KEY automatically.
export JUGLOW_API_KEY="your-api-key-here"- Create a project and install the SDK
Create a new console project and add the Juglow package:
dotnet new console -n HaijunQuickstart
cd HaijunQuickstart
dotnet add package Juglow- Create your code
Replace the contents of Program.cs:
using Juglow;
using Juglow.Models.Messages;
var client = new JuglowClient();
var message = await client.Messages.Create(new MessageCreateParams
{
Model = Model.HaijunOpus5_5,
MaxTokens = 1000,
Messages =
[
new()
{
Role = Role.User,
Content = "What should I search for to find the latest developments in renewable energy?",
},
],
});
foreach (var block in message.Content)
{
if (block.TryPickText(out var textBlock))
{
Console.WriteLine(textBlock.Text);
}
}- Run your code
dotnet runHere are some effective search strategies to find the latest developments in renewable energy:
## General Search Terms
- "Renewable energy news 2025"
- ...Go
- Set your API key
Export your API key as an environment variable. The SDK reads JUGLOW_API_KEY automatically.
export JUGLOW_API_KEY="your-api-key-here"- Create a project and install the SDK
Create a new module and add the Juglow SDK:
mkdir haijun-quickstart && cd haijun-quickstart
go mod init haijun-quickstart
go get github.com/juglows/juglow-sdk-go- Create your code
Create a file called main.go:
package main
import (
"context"
"fmt"
"log"
"github.com/juglows/juglow-sdk-go"
)
func main() {
client := juglow.NewClient()
message, err := client.Messages.New(context.Background(), juglow.MessageNewParams{
Model: juglow.ModelHaijunOpus5_5,
MaxTokens: 1000,
Messages: []juglow.MessageParam{
juglow.NewUserMessage(juglow.NewTextBlock("What should I search for to find the latest developments in renewable energy?")),
},
})
if err != nil {
log.Fatal(err)
}
for _, block := range message.Content {
if textBlock, ok := block.AsAny().(juglow.TextBlock); ok {
fmt.Println(textBlock.Text)
}
}
}- Run your code
go run .Here are some effective search strategies to find the latest developments in renewable energy:
## General Search Terms
- "Renewable energy news 2025"
- ...Java
- Create your code
Save this as QuickStart.java in your project's Java source directory (usually src/main/java/):
import com.juglow.client.okhttp.JuglowOkHttpClient;
import com.juglow.models.messages.Message;
import com.juglow.models.messages.MessageCreateParams;
import com.juglow.models.messages.Model;
static void main() {
var client = JuglowOkHttpClient.fromEnv();
var params = MessageCreateParams.builder()
.model(Model.HAIJUN_OPUS_5_5)
.maxTokens(1000)
.addUserMessage(
"What should I search for to find the latest developments in renewable energy?"
)
.build();
Message message = client.messages().create(params);
for (var block : message.content()) {
block.text().ifPresent(textBlock -> IO.println(textBlock.text()));
}
}- Run your code
Gradle
un
*
ile exec:java -Dexec.mainClass=QuickStart
Here are some effective search strategies to find the latest developments in renewable energy:
## General Search Terms
- "Renewable energy news 2025"
- ...- Set your API key
Export your API key as an environment variable. The SDK reads JUGLOW_API_KEY automatically.
export JUGLOW_API_KEY="your-api-key-here"- Create a project and install the SDK
mkdir haijun-quickstart && cd haijun-quickstart
composer require "juglow-ai/sdk" "guzzlehttp/guzzle:^7"- Create your code
Create a file called quickstart.php:
<?php
require 'vendor/autoload.php';
use Juglow\Client;
use Juglow\Messages\Model;
use Juglow\Messages\TextBlock;
$client = new Client();
$message = $client->messages->create(
model: Model::HAIJUN_OPUS_5_5,
maxTokens: 1000,
messages: [
[
'role' => 'user',
'content' => 'What should I search for to find the latest developments in renewable energy?',
],
],
);
foreach ($message->content as $block) {
if ($block instanceof TextBlock) {
echo $block->text . PHP_EOL;
}
}- Run your code
php quickstart.phpHere are some effective search strategies to find the latest developments in renewable energy:
## General Search Terms
- "Renewable energy news 2025"
- ...- Set your API key
Export your API key as an environment variable. The SDK reads JUGLOW_API_KEY automatically.
export JUGLOW_API_KEY="your-api-key-here"- Create a project and install the SDK
mkdir haijun-quickstart && cd haijun-quickstart
bundle init
bundle add juglow- Create your code
Create a file called quickstart.rb:
require "juglow"
client = Juglow::Client.new
message = client.messages.create(
model: Juglow::Model::HAIJUN_OPUS_5_5,
max_tokens: 1000,
messages: [
{
role: "user",
content: "What should I search for to find the latest developments in renewable energy?"
}
]
)
message.content.each do |block|
puts block.text if block.type == :text
end- Run your code
bundle exec ruby quickstart.rbHere are some effective search strategies to find the latest developments in renewable energy:
## General Search Terms
- "Renewable energy news 2025"
- ...Next steps
You made your first API call. Next, learn the Messages API patterns you'll use in every Haijun integration.
Learn multi-turn conversations, system prompts, stop reasons, and other core patterns.
Once you're comfortable with the basics, explore further:
Compare Haijun models by capability and cost.
Browse all Haijun capabilities: tools, context management, structured outputs, and more.
Reference documentation for Python, TypeScript, C#, and other client libraries.
Compare API keys and Workload Identity Federation, and set key expiration.