@hanzo/rooms 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,1389 @@
1
- export {};
1
+ export const INTEGRATIONS = [
2
+ {
3
+ slug: 'openai-sdk',
4
+ name: 'OpenAI Python SDK',
5
+ description: `Use the official OpenAI Python SDK with Hanzo AI by pointing it to our OpenAI-compatible API endpoint. Access every model Hanzo serves with your existing OpenAI code — no refactor needed.`,
6
+ category: 'sdk',
7
+ icon: '🐍',
8
+ upstream: 'https://github.com/openai/openai-python',
9
+ creator: 'OpenAI',
10
+ creatorUrl: 'https://openai.com',
11
+ license: 'MIT',
12
+ examples: [
13
+ {
14
+ lang: 'python',
15
+ label: 'Install & configure',
16
+ code: `pip install openai
17
+
18
+ from openai import OpenAI
19
+
20
+ client = OpenAI(
21
+ api_key="your-hanzo-api-key",
22
+ base_url="https://api.hanzo.ai/v1",
23
+ )
24
+
25
+ response = client.chat.completions.create(
26
+ model="zen4-pro",
27
+ messages=[{"role": "user", "content": "Hello!"}],
28
+ )
29
+ print(response.choices[0].message.content)`,
30
+ },
31
+ {
32
+ lang: 'python',
33
+ label: 'Streaming',
34
+ code: `stream = client.chat.completions.create(
35
+ model="openai/gpt-4.1",
36
+ messages=[{"role": "user", "content": "Write a haiku"}],
37
+ stream=True,
38
+ )
39
+ for chunk in stream:
40
+ print(chunk.choices[0].delta.content or "", end="")`,
41
+ },
42
+ {
43
+ lang: 'python',
44
+ label: 'Vision model',
45
+ code: `response = client.chat.completions.create(
46
+ model="google/gemini-2.0-flash",
47
+ messages=[{
48
+ "role": "user",
49
+ "content": [
50
+ {"type": "text", "text": "What is in this image?"},
51
+ {"type": "image_url", "image_url": {"url": "https://example.com/img.png"}},
52
+ ],
53
+ }],
54
+ )`,
55
+ },
56
+ {
57
+ lang: 'bash',
58
+ label: 'Environment variable',
59
+ code: `export HANZO_API_KEY="your-hanzo-api-key"
60
+ export OPENAI_API_KEY="$HANZO_API_KEY"
61
+ export OPENAI_BASE_URL="https://api.hanzo.ai/v1"`,
62
+ },
63
+ ],
64
+ },
65
+ {
66
+ slug: 'anthropic-sdk',
67
+ name: 'Anthropic SDK',
68
+ description: 'Use the Anthropic Python or TypeScript SDK with Hanzo AI to access Claude models alongside 50+ other models through a single API key and billing account.',
69
+ category: 'sdk',
70
+ icon: '🤖',
71
+ upstream: 'https://github.com/anthropics/anthropic-sdk-python',
72
+ creator: 'Anthropic',
73
+ creatorUrl: 'https://anthropic.com',
74
+ license: 'MIT',
75
+ examples: [
76
+ {
77
+ lang: 'python',
78
+ label: 'Python setup',
79
+ code: `pip install anthropic
80
+
81
+ import anthropic
82
+
83
+ client = anthropic.Anthropic(
84
+ api_key="your-hanzo-api-key",
85
+ base_url="https://api.hanzo.ai/v1",
86
+ )
87
+
88
+ message = client.messages.create(
89
+ model="anthropic/claude-sonnet-4-6",
90
+ max_tokens=1024,
91
+ messages=[{"role": "user", "content": "Hello, Claude!"}],
92
+ )
93
+ print(message.content[0].text)`,
94
+ },
95
+ {
96
+ lang: 'typescript',
97
+ label: 'TypeScript setup',
98
+ code: `import Anthropic from "@anthropic-ai/sdk";
99
+
100
+ const client = new Anthropic({
101
+ apiKey: process.env.HANZO_API_KEY,
102
+ baseURL: "https://api.hanzo.ai/v1",
103
+ });
104
+
105
+ const message = await client.messages.create({
106
+ model: "anthropic/claude-sonnet-4-6",
107
+ max_tokens: 1024,
108
+ messages: [{ role: "user", content: "Hello!" }],
109
+ });`,
110
+ },
111
+ {
112
+ lang: 'python',
113
+ label: 'Streaming',
114
+ code: `with client.messages.stream(
115
+ model="glm-5.2",
116
+ max_tokens=1024,
117
+ messages=[{"role": "user", "content": "Tell me a story"}],
118
+ ) as stream:
119
+ for text in stream.text_stream:
120
+ print(text, end="", flush=True)`,
121
+ },
122
+ {
123
+ lang: 'bash',
124
+ label: 'cURL test',
125
+ code: `curl https://api.hanzo.ai/v1/messages \\
126
+ -H "x-api-key: $HANZO_API_KEY" \\
127
+ -H "anthropic-version: 2023-06-01" \\
128
+ -H "content-type: application/json" \\
129
+ -d '{"model":"anthropic/claude-sonnet-4-6","max_tokens":100,"messages":[{"role":"user","content":"Hi"}]}'`,
130
+ },
131
+ ],
132
+ },
133
+ {
134
+ slug: 'langchain',
135
+ name: 'LangChain',
136
+ description: `Integrate LangChain with Hanzo AI to build chains, agents, and RAG pipelines using any model Hanzo serves. Hanzo is OpenAI-compatible so ChatOpenAI just works.`,
137
+ category: 'framework',
138
+ icon: '⛓️',
139
+ upstream: 'https://github.com/langchain-ai/langchain',
140
+ creator: 'LangChain AI',
141
+ creatorUrl: 'https://langchain.com',
142
+ license: 'MIT',
143
+ examples: [
144
+ {
145
+ lang: 'python',
146
+ label: 'LangChain Python',
147
+ code: `pip install langchain langchain-openai
148
+
149
+ from langchain_openai import ChatOpenAI
150
+
151
+ llm = ChatOpenAI(
152
+ model="zen4-pro",
153
+ openai_api_key="your-hanzo-api-key",
154
+ openai_api_base="https://api.hanzo.ai/v1",
155
+ )
156
+
157
+ response = llm.invoke("What is the capital of France?")
158
+ print(response.content)`,
159
+ },
160
+ {
161
+ lang: 'python',
162
+ label: 'Chain with prompt',
163
+ code: `from langchain_core.prompts import ChatPromptTemplate
164
+ from langchain_openai import ChatOpenAI
165
+
166
+ prompt = ChatPromptTemplate.from_template("Summarize: {text}")
167
+ llm = ChatOpenAI(
168
+ model="openai/gpt-4.1-mini",
169
+ openai_api_key="your-hanzo-api-key",
170
+ openai_api_base="https://api.hanzo.ai/v1",
171
+ )
172
+ chain = prompt | llm
173
+ result = chain.invoke({"text": "LangChain is a framework..."})`,
174
+ },
175
+ {
176
+ lang: 'typescript',
177
+ label: 'LangChain TypeScript',
178
+ code: `import { ChatOpenAI } from "@langchain/openai";
179
+
180
+ const model = new ChatOpenAI({
181
+ modelName: "zen4-pro",
182
+ openAIApiKey: process.env.HANZO_API_KEY,
183
+ configuration: {
184
+ baseURL: "https://api.hanzo.ai/v1",
185
+ },
186
+ });
187
+
188
+ const response = await model.invoke("Hello!");`,
189
+ },
190
+ {
191
+ lang: 'python',
192
+ label: 'RAG with Hanzo',
193
+ code: `from langchain_openai import ChatOpenAI, OpenAIEmbeddings
194
+
195
+ embeddings = OpenAIEmbeddings(
196
+ openai_api_key="your-hanzo-api-key",
197
+ openai_api_base="https://api.hanzo.ai/v1",
198
+ model="openai/text-embedding-3-large",
199
+ )
200
+
201
+ llm = ChatOpenAI(
202
+ model="zen4-pro",
203
+ openai_api_key="your-hanzo-api-key",
204
+ openai_api_base="https://api.hanzo.ai/v1",
205
+ )`,
206
+ },
207
+ ],
208
+ },
209
+ {
210
+ slug: 'llamaindex',
211
+ name: 'LlamaIndex',
212
+ description: 'Use LlamaIndex with Hanzo AI to build powerful RAG applications, data agents, and query pipelines. Drop in Hanzo as your LLM provider with zero friction.',
213
+ category: 'framework',
214
+ icon: '🦙',
215
+ upstream: 'https://github.com/run-llama/llama_index',
216
+ creator: 'LlamaIndex',
217
+ creatorUrl: 'https://llamaindex.ai',
218
+ license: 'MIT',
219
+ examples: [
220
+ {
221
+ lang: 'python',
222
+ label: 'Basic setup',
223
+ code: `pip install llama-index llama-index-llms-openai
224
+
225
+ from llama_index.llms.openai import OpenAI
226
+ from llama_index.core import Settings
227
+
228
+ Settings.llm = OpenAI(
229
+ model="zen4-pro",
230
+ api_key="your-hanzo-api-key",
231
+ api_base="https://api.hanzo.ai/v1",
232
+ )`,
233
+ },
234
+ {
235
+ lang: 'python',
236
+ label: 'RAG pipeline',
237
+ code: `from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
238
+ from llama_index.llms.openai import OpenAI
239
+ from llama_index.embeddings.openai import OpenAIEmbedding
240
+
241
+ Settings.llm = OpenAI(
242
+ model="zen4-pro",
243
+ api_key="your-hanzo-api-key",
244
+ api_base="https://api.hanzo.ai/v1",
245
+ )
246
+ Settings.embed_model = OpenAIEmbedding(
247
+ api_key="your-hanzo-api-key",
248
+ api_base="https://api.hanzo.ai/v1",
249
+ )
250
+
251
+ documents = SimpleDirectoryReader("./data").load_data()
252
+ index = VectorStoreIndex.from_documents(documents)
253
+ query_engine = index.as_query_engine()
254
+ response = query_engine.query("What is in these docs?")`,
255
+ },
256
+ {
257
+ lang: 'python',
258
+ label: 'Chat engine',
259
+ code: `chat_engine = index.as_chat_engine(
260
+ chat_mode="condense_plus_context",
261
+ verbose=True,
262
+ )
263
+ response = chat_engine.chat("Tell me more about this topic")`,
264
+ },
265
+ {
266
+ lang: 'python',
267
+ label: 'Streaming query',
268
+ code: `streaming_response = query_engine.query(
269
+ "Summarize the key points",
270
+ streaming=True,
271
+ )
272
+ streaming_response.print_response_stream()`,
273
+ },
274
+ ],
275
+ },
276
+ {
277
+ slug: 'vercel-ai-sdk',
278
+ name: 'Vercel AI SDK',
279
+ description: 'Use the Vercel AI SDK with Hanzo AI to build streaming AI UIs, chatbots, and generative interfaces in Next.js, React, and other frameworks.',
280
+ category: 'framework',
281
+ icon: '▲',
282
+ upstream: 'https://github.com/vercel/ai',
283
+ creator: 'Vercel',
284
+ creatorUrl: 'https://vercel.com',
285
+ license: 'Apache-2.0',
286
+ examples: [
287
+ {
288
+ lang: 'typescript',
289
+ label: 'Setup provider',
290
+ code: `npm install ai @ai-sdk/openai
291
+
292
+ import { createOpenAI } from "@ai-sdk/openai";
293
+
294
+ const hanzo = createOpenAI({
295
+ baseURL: "https://api.hanzo.ai/v1",
296
+ apiKey: process.env.HANZO_API_KEY,
297
+ });`,
298
+ },
299
+ {
300
+ lang: 'typescript',
301
+ label: 'generateText',
302
+ code: `import { generateText } from "ai";
303
+ import { createOpenAI } from "@ai-sdk/openai";
304
+
305
+ const hanzo = createOpenAI({
306
+ baseURL: "https://api.hanzo.ai/v1",
307
+ apiKey: process.env.HANZO_API_KEY,
308
+ });
309
+
310
+ const { text } = await generateText({
311
+ model: hanzo("zen4-pro"),
312
+ prompt: "Write a poem about AI",
313
+ });`,
314
+ },
315
+ {
316
+ lang: 'typescript',
317
+ label: 'Streaming route handler',
318
+ code: `// app/v1/chat/route.ts
319
+ import { streamText } from "ai";
320
+ import { createOpenAI } from "@ai-sdk/openai";
321
+
322
+ const hanzo = createOpenAI({
323
+ baseURL: "https://api.hanzo.ai/v1",
324
+ apiKey: process.env.HANZO_API_KEY,
325
+ });
326
+
327
+ export async function POST(req: Request) {
328
+ const { messages } = await req.json();
329
+ const result = streamText({
330
+ model: hanzo("zen4-pro"),
331
+ messages,
332
+ });
333
+ return result.toDataStreamResponse();
334
+ }`,
335
+ },
336
+ {
337
+ lang: 'typescript',
338
+ label: 'useChat hook',
339
+ code: `"use client";
340
+ import { useChat } from "ai/react";
341
+
342
+ export default function Chat() {
343
+ const { messages, input, handleSubmit, handleInputChange } = useChat({
344
+ api: "/v1/chat",
345
+ });
346
+ return (
347
+ <form onSubmit={handleSubmit}>
348
+ <input value={input} onChange={handleInputChange} />
349
+ <button type="submit">Send</button>
350
+ {messages.map((m) => <p key={m.id}>{m.content}</p>)}
351
+ </form>
352
+ );
353
+ }`,
354
+ },
355
+ ],
356
+ },
357
+ {
358
+ slug: 'huggingface',
359
+ name: 'Hugging Face',
360
+ description: 'Access Hugging Face models and use the HF Inference API through the Hanzo AI API. Also use Hanzo AI models with HuggingFace Hub tooling.',
361
+ category: 'sdk',
362
+ icon: '🤗',
363
+ upstream: 'https://github.com/huggingface/transformers',
364
+ creator: 'Hugging Face',
365
+ creatorUrl: 'https://huggingface.co',
366
+ license: 'Apache-2.0',
367
+ examples: [
368
+ {
369
+ lang: 'python',
370
+ label: 'InferenceClient via Hanzo',
371
+ code: `pip install huggingface_hub
372
+
373
+ from huggingface_hub import InferenceClient
374
+
375
+ client = InferenceClient(
376
+ base_url="https://api.hanzo.ai/v1",
377
+ api_key="your-hanzo-api-key",
378
+ )
379
+
380
+ output = client.chat.completions.create(
381
+ model="meta-llama/llama-4-scout",
382
+ messages=[{"role": "user", "content": "Hello!"}],
383
+ )`,
384
+ },
385
+ {
386
+ lang: 'python',
387
+ label: 'hf CLI with Hanzo endpoint',
388
+ code: `# Use hf for model downloads, Hanzo for inference
389
+ hf download meta-llama/Llama-4-Scout-17B-16E-Instruct
390
+
391
+ # Then serve via Hanzo API
392
+ from openai import OpenAI
393
+ client = OpenAI(
394
+ base_url="https://api.hanzo.ai/v1",
395
+ api_key="your-hanzo-api-key",
396
+ )`,
397
+ },
398
+ {
399
+ lang: 'typescript',
400
+ label: 'JS InferenceClient',
401
+ code: `import { InferenceClient } from "@huggingface/inference";
402
+
403
+ const client = new InferenceClient("your-hanzo-api-key");
404
+
405
+ const chatCompletion = await client.chatCompletion({
406
+ model: "meta-llama/llama-4-scout",
407
+ messages: [{ role: "user", content: "Hello!" }],
408
+ provider: "hanzo",
409
+ endpointUrl: "https://api.hanzo.ai/v1",
410
+ });`,
411
+ },
412
+ {
413
+ lang: 'bash',
414
+ label: 'cURL inference',
415
+ code: `curl https://api.hanzo.ai/v1/chat/completions \\
416
+ -H "Authorization: Bearer $HANZO_API_KEY" \\
417
+ -H "Content-Type: application/json" \\
418
+ -d '{"model":"meta-llama/llama-4-maverick","messages":[{"role":"user","content":"Hi"}]}'`,
419
+ },
420
+ ],
421
+ },
422
+ {
423
+ slug: 'autogen',
424
+ name: 'AutoGen',
425
+ description: 'Build multi-agent systems with Microsoft AutoGen. Set base_url to api.hanzo.ai/v1 in the AutoGen config, name a Hanzo model, and the agents run on it.',
426
+ category: 'framework',
427
+ icon: '🤝',
428
+ upstream: 'https://github.com/microsoft/autogen',
429
+ creator: 'Microsoft Research',
430
+ creatorUrl: 'https://microsoft.com/en-us/research',
431
+ license: 'MIT',
432
+ examples: [
433
+ {
434
+ lang: 'python',
435
+ label: 'AutoGen setup',
436
+ code: `pip install pyautogen
437
+
438
+ import autogen
439
+
440
+ config_list = [{
441
+ "model": "zen4-pro",
442
+ "api_key": "your-hanzo-api-key",
443
+ "base_url": "https://api.hanzo.ai/v1",
444
+ }]
445
+
446
+ assistant = autogen.AssistantAgent(
447
+ name="assistant",
448
+ llm_config={"config_list": config_list},
449
+ )
450
+
451
+ user_proxy = autogen.UserProxyAgent(
452
+ name="user_proxy",
453
+ human_input_mode="NEVER",
454
+ )
455
+
456
+ user_proxy.initiate_chat(assistant, message="Write a Python script to sort a list.")`,
457
+ },
458
+ {
459
+ lang: 'python',
460
+ label: 'Multi-agent conversation',
461
+ code: `coder = autogen.AssistantAgent(
462
+ name="coder",
463
+ llm_config={"config_list": config_list},
464
+ system_message="You write clean Python code.",
465
+ )
466
+
467
+ reviewer = autogen.AssistantAgent(
468
+ name="reviewer",
469
+ llm_config={"config_list": config_list},
470
+ system_message="You review code for bugs.",
471
+ )
472
+
473
+ groupchat = autogen.GroupChat(agents=[user_proxy, coder, reviewer], messages=[])
474
+ manager = autogen.GroupChatManager(groupchat=groupchat, llm_config={"config_list": config_list})`,
475
+ },
476
+ {
477
+ lang: 'python',
478
+ label: 'Code execution agent',
479
+ code: `user_proxy = autogen.UserProxyAgent(
480
+ name="user_proxy",
481
+ human_input_mode="NEVER",
482
+ code_execution_config={"work_dir": "coding", "use_docker": False},
483
+ )`,
484
+ },
485
+ {
486
+ lang: 'bash',
487
+ label: 'Environment setup',
488
+ code: `export HANZO_API_KEY="your-hanzo-api-key"
489
+ # AutoGen picks up OAI_CONFIG_LIST or inline config
490
+ # No extra env vars needed — just point base_url to Hanzo`,
491
+ },
492
+ ],
493
+ },
494
+ {
495
+ slug: 'crewai',
496
+ name: 'CrewAI',
497
+ description: 'Use CrewAI to build collaborative AI agent teams powered by Hanzo AI models. CrewAI\'s role-based agents work with any OpenAI-compatible provider.',
498
+ category: 'framework',
499
+ icon: '🚢',
500
+ upstream: 'https://github.com/crewAIInc/crewAI',
501
+ creator: 'CrewAI / João Moura',
502
+ creatorUrl: 'https://crewai.com',
503
+ license: 'MIT',
504
+ examples: [
505
+ {
506
+ lang: 'python',
507
+ label: 'CrewAI with Hanzo',
508
+ code: `pip install crewai
509
+
510
+ import os
511
+ os.environ["OPENAI_API_KEY"] = "your-hanzo-api-key"
512
+ os.environ["OPENAI_API_BASE"] = "https://api.hanzo.ai/v1"
513
+ os.environ["OPENAI_MODEL_NAME"] = "zen4-pro"
514
+
515
+ from crewai import Agent, Task, Crew
516
+
517
+ researcher = Agent(
518
+ role="Researcher",
519
+ goal="Find accurate information on AI trends",
520
+ backstory="Expert AI researcher with deep knowledge",
521
+ )
522
+
523
+ writer = Agent(
524
+ role="Writer",
525
+ goal="Write compelling summaries",
526
+ backstory="Technical writer specializing in AI",
527
+ )`,
528
+ },
529
+ {
530
+ lang: 'python',
531
+ label: 'Tasks and Crew',
532
+ code: `task1 = Task(
533
+ description="Research the latest LLM benchmarks",
534
+ expected_output="A list of top 5 models and their scores",
535
+ agent=researcher,
536
+ )
537
+
538
+ task2 = Task(
539
+ description="Write a blog post based on the research",
540
+ expected_output="500-word blog post in markdown",
541
+ agent=writer,
542
+ )
543
+
544
+ crew = Crew(agents=[researcher, writer], tasks=[task1, task2])
545
+ result = crew.kickoff()`,
546
+ },
547
+ {
548
+ lang: 'python',
549
+ label: 'Custom LLM config',
550
+ code: `from crewai import LLM
551
+
552
+ hanzo_llm = LLM(
553
+ model="zen4-pro",
554
+ api_key="your-hanzo-api-key",
555
+ base_url="https://api.hanzo.ai/v1",
556
+ )
557
+
558
+ agent = Agent(
559
+ role="Analyst",
560
+ goal="Analyze data",
561
+ backstory="Data analyst",
562
+ llm=hanzo_llm,
563
+ )`,
564
+ },
565
+ {
566
+ lang: 'bash',
567
+ label: 'Quick start',
568
+ code: `pip install crewai
569
+ export OPENAI_API_KEY="your-hanzo-api-key"
570
+ export OPENAI_BASE_URL="https://api.hanzo.ai/v1"
571
+ crewai create my-crew`,
572
+ },
573
+ ],
574
+ },
575
+ {
576
+ slug: 'dspy',
577
+ name: 'DSPy',
578
+ description: 'Use DSPy to program (not prompt) Hanzo AI models. DSPy\'s systematic approach to LM prompting works with any OpenAI-compatible provider.',
579
+ category: 'framework',
580
+ icon: '🔬',
581
+ upstream: 'https://github.com/stanfordnlp/dspy',
582
+ creator: 'Stanford NLP / Omar Khattab',
583
+ creatorUrl: 'https://dspy.ai',
584
+ license: 'MIT',
585
+ examples: [
586
+ {
587
+ lang: 'python',
588
+ label: 'DSPy + Hanzo setup',
589
+ code: `pip install dspy
590
+
591
+ import dspy
592
+
593
+ lm = dspy.LM(
594
+ model="openai/zen4-pro",
595
+ api_key="your-hanzo-api-key",
596
+ api_base="https://api.hanzo.ai/v1",
597
+ )
598
+ dspy.configure(lm=lm)`,
599
+ },
600
+ {
601
+ lang: 'python',
602
+ label: 'Signature and module',
603
+ code: `class QA(dspy.Signature):
604
+ """Answer questions with short factual answers."""
605
+ question: str = dspy.InputField()
606
+ answer: str = dspy.OutputField(desc="often 1-3 sentences")
607
+
608
+ qa = dspy.Predict(QA)
609
+ response = qa(question="What is the Hanzo AI cloud?")
610
+ print(response.answer)`,
611
+ },
612
+ {
613
+ lang: 'python',
614
+ label: 'Chain of thought',
615
+ code: `class CoTQA(dspy.Signature):
616
+ """Answer with step-by-step reasoning."""
617
+ question: str = dspy.InputField()
618
+ reasoning: str = dspy.OutputField(desc="think step by step")
619
+ answer: str = dspy.OutputField()
620
+
621
+ cot = dspy.ChainOfThought(CoTQA)
622
+ result = cot(question="Why is AI important for developers?")`,
623
+ },
624
+ {
625
+ lang: 'python',
626
+ label: 'Optimization with MIPROv2',
627
+ code: `from dspy.teleprompt import MIPROv2
628
+
629
+ teleprompter = MIPROv2(metric=my_metric, auto="medium")
630
+ optimized = teleprompter.compile(program, trainset=train_data)`,
631
+ },
632
+ ],
633
+ },
634
+ {
635
+ slug: 'haystack',
636
+ name: 'Haystack',
637
+ description: 'Build NLP pipelines and RAG systems with Haystack. Point OpenAIChatGenerator at api.hanzo.ai/v1, name a Hanzo model, and the pipeline runs unchanged.',
638
+ category: 'framework',
639
+ icon: '🌾',
640
+ upstream: 'https://github.com/deepset-ai/haystack',
641
+ creator: 'deepset.ai',
642
+ creatorUrl: 'https://haystack.deepset.ai',
643
+ license: 'Apache-2.0',
644
+ examples: [
645
+ {
646
+ lang: 'python',
647
+ label: 'Haystack + Hanzo',
648
+ code: `pip install haystack-ai
649
+
650
+ from haystack.components.generators.chat import OpenAIChatGenerator
651
+ from haystack.dataclasses import ChatMessage
652
+ from haystack.utils import Secret
653
+
654
+ generator = OpenAIChatGenerator(
655
+ model="zen4-pro",
656
+ api_key=Secret.from_token("your-hanzo-api-key"),
657
+ api_base_url="https://api.hanzo.ai/v1",
658
+ )
659
+
660
+ messages = [ChatMessage.from_user("What is RAG?")]
661
+ result = generator.run(messages=messages)`,
662
+ },
663
+ {
664
+ lang: 'python',
665
+ label: 'RAG pipeline',
666
+ code: `from haystack import Pipeline
667
+ from haystack.components.builders import PromptBuilder
668
+ from haystack.components.generators.chat import OpenAIChatGenerator
669
+
670
+ prompt_template = """
671
+ Context: {% for doc in documents %}{{ doc.content }}{% endfor %}
672
+ Question: {{ question }}
673
+ Answer:
674
+ """
675
+
676
+ pipeline = Pipeline()
677
+ pipeline.add_component("prompt", PromptBuilder(template=prompt_template))
678
+ pipeline.add_component("llm", OpenAIChatGenerator(
679
+ model="zen4-pro",
680
+ api_key=Secret.from_token("your-hanzo-api-key"),
681
+ api_base_url="https://api.hanzo.ai/v1",
682
+ ))`,
683
+ },
684
+ {
685
+ lang: 'python',
686
+ label: 'Embeddings',
687
+ code: `from haystack.components.embedders import OpenAITextEmbedder
688
+
689
+ embedder = OpenAITextEmbedder(
690
+ model="openai/text-embedding-3-large",
691
+ api_key=Secret.from_token("your-hanzo-api-key"),
692
+ api_base_url="https://api.hanzo.ai/v1",
693
+ )`,
694
+ },
695
+ {
696
+ lang: 'bash',
697
+ label: 'Install',
698
+ code: `pip install haystack-ai
699
+ export HANZO_API_KEY="your-hanzo-api-key"`,
700
+ },
701
+ ],
702
+ },
703
+ {
704
+ slug: 'cursor',
705
+ name: 'Cursor',
706
+ description: 'Use Hanzo AI models inside Cursor IDE by adding a custom API provider. Access Zen, GPT-4.1, Claude Sonnet, and 50+ other models directly in your editor.',
707
+ category: 'platform',
708
+ icon: '🖱️',
709
+ upstream: 'https://github.com/getcursor/cursor',
710
+ creator: 'Anysphere',
711
+ creatorUrl: 'https://cursor.com',
712
+ license: 'Proprietary',
713
+ examples: [
714
+ {
715
+ lang: 'json',
716
+ label: 'Cursor settings',
717
+ code: `// Settings > Models > Add custom model
718
+ {
719
+ "provider": "openai-compatible",
720
+ "name": "Hanzo AI",
721
+ "baseUrl": "https://api.hanzo.ai/v1",
722
+ "apiKey": "your-hanzo-api-key",
723
+ "models": ["zen4-pro", "zen4-max", "openai/gpt-4.1", "anthropic/claude-sonnet-4-6"]
724
+ }`,
725
+ },
726
+ {
727
+ lang: 'bash',
728
+ label: 'Available models',
729
+ code: `# Query Hanzo models list
730
+ curl https://api.hanzo.ai/v1/models \\
731
+ -H "Authorization: Bearer $HANZO_API_KEY" | jq '.data[].id'`,
732
+ },
733
+ {
734
+ lang: 'bash',
735
+ label: 'Test connection',
736
+ code: `curl https://api.hanzo.ai/v1/chat/completions \\
737
+ -H "Authorization: Bearer $HANZO_API_KEY" \\
738
+ -H "Content-Type: application/json" \\
739
+ -d '{"model":"zen4-pro","messages":[{"role":"user","content":"Hello from Cursor!"}],"max_tokens":50}'`,
740
+ },
741
+ {
742
+ lang: 'bash',
743
+ label: 'Tips',
744
+ code: `# zen4-pro: best for code generation
745
+ # zen4-coder: specialized code model
746
+ # zen4-thinking: step-by-step reasoning
747
+ # openai/gpt-4.1: advanced reasoning
748
+ # All available at api.hanzo.ai/v1`,
749
+ },
750
+ ],
751
+ },
752
+ {
753
+ slug: 'continue-dev',
754
+ name: 'Continue.dev',
755
+ description: 'Configure Continue.dev VS Code / JetBrains extension to use Hanzo AI as your coding assistant. Add Hanzo as a custom OpenAI-compatible provider in your config.',
756
+ category: 'platform',
757
+ icon: '🔄',
758
+ upstream: 'https://github.com/continuedev/continue',
759
+ creator: 'Continue.dev',
760
+ creatorUrl: 'https://continue.dev',
761
+ license: 'Apache-2.0',
762
+ examples: [
763
+ {
764
+ lang: 'json',
765
+ label: '~/.continue/config.json',
766
+ code: `{
767
+ "models": [
768
+ {
769
+ "title": "Hanzo zen4-pro",
770
+ "provider": "openai",
771
+ "model": "zen4-pro",
772
+ "apiKey": "your-hanzo-api-key",
773
+ "apiBase": "https://api.hanzo.ai/v1"
774
+ },
775
+ {
776
+ "title": "Hanzo zen4-coder",
777
+ "provider": "openai",
778
+ "model": "zen4-coder",
779
+ "apiKey": "your-hanzo-api-key",
780
+ "apiBase": "https://api.hanzo.ai/v1"
781
+ }
782
+ ],
783
+ "tabAutocompleteModel": {
784
+ "title": "Hanzo Autocomplete",
785
+ "provider": "openai",
786
+ "model": "zen4-coder",
787
+ "apiKey": "your-hanzo-api-key",
788
+ "apiBase": "https://api.hanzo.ai/v1"
789
+ }
790
+ }`,
791
+ },
792
+ {
793
+ lang: 'json',
794
+ label: 'Embeddings config',
795
+ code: `{
796
+ "embeddingsProvider": {
797
+ "provider": "openai",
798
+ "model": "openai/text-embedding-3-large",
799
+ "apiKey": "your-hanzo-api-key",
800
+ "apiBase": "https://api.hanzo.ai/v1"
801
+ }
802
+ }`,
803
+ },
804
+ {
805
+ lang: 'bash',
806
+ label: 'Install Continue',
807
+ code: `# VS Code
808
+ code --install-extension Continue.continue
809
+
810
+ # JetBrains: install from marketplace
811
+ # Then edit ~/.continue/config.json`,
812
+ },
813
+ {
814
+ lang: 'bash',
815
+ label: 'Test API',
816
+ code: `curl https://api.hanzo.ai/v1/chat/completions \\
817
+ -H "Authorization: Bearer $HANZO_API_KEY" \\
818
+ -d '{"model":"zen4-coder","messages":[{"role":"user","content":"Complete this: def hello():"}]}'`,
819
+ },
820
+ ],
821
+ },
822
+ {
823
+ slug: 'github-copilot',
824
+ name: 'GitHub Copilot',
825
+ description: 'Extend your GitHub Copilot workflow with Hanzo AI for access to additional models and capabilities via the API. Use Hanzo for tasks Copilot can\'t handle.',
826
+ category: 'platform',
827
+ icon: '🐙',
828
+ upstream: 'https://github.com/features/copilot',
829
+ creator: 'GitHub / Microsoft',
830
+ creatorUrl: 'https://github.com',
831
+ license: 'Proprietary',
832
+ examples: [
833
+ {
834
+ lang: 'python',
835
+ label: 'Hanzo API alongside Copilot',
836
+ code: `# Use GitHub Copilot in editor, Hanzo API in code
837
+ from openai import OpenAI
838
+
839
+ # Hanzo for programmatic access
840
+ client = OpenAI(
841
+ base_url="https://api.hanzo.ai/v1",
842
+ api_key="your-hanzo-api-key",
843
+ )
844
+
845
+ # Access the models Copilot does not offer
846
+ response = client.chat.completions.create(
847
+ model="zen4-pro",
848
+ messages=[{"role": "user", "content": "Review this code..."}],
849
+ )`,
850
+ },
851
+ {
852
+ lang: 'typescript',
853
+ label: 'GitHub Actions with Hanzo',
854
+ code: `// In CI: use Hanzo AI for code review
855
+ import OpenAI from "openai";
856
+
857
+ const client = new OpenAI({
858
+ baseURL: "https://api.hanzo.ai/v1",
859
+ apiKey: process.env.HANZO_API_KEY,
860
+ });
861
+
862
+ const review = await client.chat.completions.create({
863
+ model: "zen4-pro",
864
+ messages: [{
865
+ role: "user",
866
+ content: \`Review this PR diff:\n\${diff}\`,
867
+ }],
868
+ });`,
869
+ },
870
+ {
871
+ lang: 'yaml',
872
+ label: 'GitHub Actions workflow',
873
+ code: `name: AI Code Review
874
+ on: [pull_request]
875
+ jobs:
876
+ review:
877
+ runs-on: ubuntu-latest
878
+ steps:
879
+ - uses: actions/checkout@v4
880
+ - name: AI Review
881
+ env:
882
+ HANZO_API_KEY: \${{ secrets.HANZO_API_KEY }}
883
+ run: |
884
+ pip install openai
885
+ python scripts/ai_review.py`,
886
+ },
887
+ {
888
+ lang: 'bash',
889
+ label: 'API key setup',
890
+ code: `# Add to GitHub repo secrets
891
+ # Settings > Secrets > Actions > New secret
892
+ # Name: HANZO_API_KEY
893
+ # Value: your-hanzo-api-key`,
894
+ },
895
+ ],
896
+ },
897
+ {
898
+ slug: 'docker',
899
+ name: 'Docker',
900
+ description: 'Deploy Hanzo AI-powered services in Docker containers. Use the Hanzo API from any containerized application with proper environment configuration.',
901
+ category: 'infra',
902
+ icon: '🐳',
903
+ upstream: 'https://github.com/moby/moby',
904
+ creator: 'Docker / Moby Project',
905
+ creatorUrl: 'https://docker.com',
906
+ license: 'Apache-2.0',
907
+ examples: [
908
+ {
909
+ lang: 'dockerfile',
910
+ label: 'Dockerfile',
911
+ code: `FROM python:3.12-slim
912
+
913
+ WORKDIR /app
914
+ COPY requirements.txt .
915
+ RUN pip install -r requirements.txt
916
+
917
+ COPY . .
918
+
919
+ ENV HANZO_API_KEY=""
920
+ ENV OPENAI_API_BASE="https://api.hanzo.ai/v1"
921
+
922
+ CMD ["python", "main.py"]`,
923
+ },
924
+ {
925
+ lang: 'yaml',
926
+ label: 'compose.yml',
927
+ code: `services:
928
+ app:
929
+ build: .
930
+ environment:
931
+ - HANZO_API_KEY=\${HANZO_API_KEY}
932
+ - OPENAI_API_BASE=https://api.hanzo.ai/v1
933
+ ports:
934
+ - "8000:8000"
935
+ restart: unless-stopped`,
936
+ },
937
+ {
938
+ lang: 'bash',
939
+ label: 'Run with env',
940
+ code: `# .env file
941
+ HANZO_API_KEY=your-hanzo-api-key
942
+
943
+ # Start
944
+ docker compose up -d
945
+
946
+ # Or direct run
947
+ docker run -e HANZO_API_KEY=your-key -p 8000:8000 my-ai-app`,
948
+ },
949
+ {
950
+ lang: 'python',
951
+ label: 'App code',
952
+ code: `import os
953
+ from openai import OpenAI
954
+
955
+ client = OpenAI(
956
+ base_url=os.environ.get("OPENAI_API_BASE", "https://api.hanzo.ai/v1"),
957
+ api_key=os.environ["HANZO_API_KEY"],
958
+ )`,
959
+ },
960
+ ],
961
+ },
962
+ {
963
+ slug: 'kubernetes',
964
+ name: 'Kubernetes',
965
+ description: 'Deploy Hanzo AI-powered workloads on Kubernetes. Securely manage your Hanzo API key as a K8s secret and inject it into pods.',
966
+ category: 'infra',
967
+ icon: '⚓',
968
+ upstream: 'https://github.com/kubernetes/kubernetes',
969
+ creator: 'CNCF / Google',
970
+ creatorUrl: 'https://kubernetes.io',
971
+ license: 'Apache-2.0',
972
+ examples: [
973
+ {
974
+ lang: 'yaml',
975
+ label: 'K8s Secret',
976
+ code: `apiVersion: v1
977
+ kind: Secret
978
+ metadata:
979
+ name: hanzo-credentials
980
+ namespace: default
981
+ type: Opaque
982
+ stringData:
983
+ api-key: "your-hanzo-api-key"`,
984
+ },
985
+ {
986
+ lang: 'yaml',
987
+ label: 'Deployment manifest',
988
+ code: `apiVersion: apps/v1
989
+ kind: Deployment
990
+ metadata:
991
+ name: ai-service
992
+ spec:
993
+ replicas: 2
994
+ selector:
995
+ matchLabels:
996
+ app: ai-service
997
+ template:
998
+ spec:
999
+ containers:
1000
+ - name: app
1001
+ image: my-ai-app:latest
1002
+ env:
1003
+ - name: HANZO_API_KEY
1004
+ valueFrom:
1005
+ secretKeyRef:
1006
+ name: hanzo-credentials
1007
+ key: api-key
1008
+ - name: OPENAI_API_BASE
1009
+ value: "https://api.hanzo.ai/v1"`,
1010
+ },
1011
+ {
1012
+ lang: 'bash',
1013
+ label: 'Apply to cluster',
1014
+ code: `kubectl create secret generic hanzo-credentials \\
1015
+ --from-literal=api-key="your-hanzo-api-key"
1016
+
1017
+ kubectl apply -f deployment.yaml
1018
+ kubectl get pods -l app=ai-service`,
1019
+ },
1020
+ {
1021
+ lang: 'yaml',
1022
+ label: 'HPA for AI workloads',
1023
+ code: `apiVersion: autoscaling/v2
1024
+ kind: HorizontalPodAutoscaler
1025
+ metadata:
1026
+ name: ai-service-hpa
1027
+ spec:
1028
+ scaleTargetRef:
1029
+ apiVersion: apps/v1
1030
+ kind: Deployment
1031
+ name: ai-service
1032
+ minReplicas: 2
1033
+ maxReplicas: 10
1034
+ metrics:
1035
+ - type: Resource
1036
+ resource:
1037
+ name: cpu
1038
+ target:
1039
+ type: Utilization
1040
+ averageUtilization: 70`,
1041
+ },
1042
+ ],
1043
+ },
1044
+ {
1045
+ slug: 'python',
1046
+ name: 'Python',
1047
+ description: 'Use Hanzo AI in Python with the official OpenAI SDK (fully compatible), the Anthropic SDK, or via HTTP with httpx/requests. Zero lock-in, standard interfaces.',
1048
+ category: 'language',
1049
+ icon: '🐍',
1050
+ upstream: 'https://github.com/python/cpython',
1051
+ creator: 'Python Software Foundation',
1052
+ creatorUrl: 'https://python.org',
1053
+ license: 'PSF License',
1054
+ examples: [
1055
+ {
1056
+ lang: 'python',
1057
+ label: 'OpenAI SDK (recommended)',
1058
+ code: `pip install openai
1059
+
1060
+ from openai import OpenAI
1061
+
1062
+ client = OpenAI(
1063
+ base_url="https://api.hanzo.ai/v1",
1064
+ api_key="your-hanzo-api-key",
1065
+ )
1066
+
1067
+ response = client.chat.completions.create(
1068
+ model="zen4-pro",
1069
+ messages=[{"role": "user", "content": "Hello!"}],
1070
+ )
1071
+ print(response.choices[0].message.content)`,
1072
+ },
1073
+ {
1074
+ lang: 'python',
1075
+ label: 'httpx (raw HTTP)',
1076
+ code: `import httpx, json
1077
+
1078
+ response = httpx.post(
1079
+ "https://api.hanzo.ai/v1/chat/completions",
1080
+ headers={"Authorization": "Bearer your-hanzo-api-key"},
1081
+ json={
1082
+ "model": "zen4-pro",
1083
+ "messages": [{"role": "user", "content": "Hello!"}],
1084
+ },
1085
+ )
1086
+ print(response.json()["choices"][0]["message"]["content"])`,
1087
+ },
1088
+ {
1089
+ lang: 'python',
1090
+ label: 'Async with asyncio',
1091
+ code: `import asyncio
1092
+ from openai import AsyncOpenAI
1093
+
1094
+ client = AsyncOpenAI(
1095
+ base_url="https://api.hanzo.ai/v1",
1096
+ api_key="your-hanzo-api-key",
1097
+ )
1098
+
1099
+ async def main():
1100
+ response = await client.chat.completions.create(
1101
+ model="zen4-pro",
1102
+ messages=[{"role": "user", "content": "Hello async!"}],
1103
+ )
1104
+ print(response.choices[0].message.content)
1105
+
1106
+ asyncio.run(main())`,
1107
+ },
1108
+ {
1109
+ lang: 'python',
1110
+ label: 'Environment setup',
1111
+ code: `# .env
1112
+ HANZO_API_KEY=your-hanzo-api-key
1113
+
1114
+ # Load in code
1115
+ from dotenv import load_dotenv
1116
+ import os
1117
+
1118
+ load_dotenv()
1119
+
1120
+ from openai import OpenAI
1121
+ client = OpenAI(
1122
+ base_url="https://api.hanzo.ai/v1",
1123
+ api_key=os.environ["HANZO_API_KEY"],
1124
+ )`,
1125
+ },
1126
+ ],
1127
+ },
1128
+ {
1129
+ slug: 'typescript',
1130
+ name: 'TypeScript',
1131
+ description: 'Use Hanzo AI in TypeScript and Node.js with the OpenAI SDK, Vercel AI SDK, or raw fetch. Full type safety and async/streaming support.',
1132
+ category: 'language',
1133
+ icon: '🟦',
1134
+ upstream: 'https://github.com/microsoft/TypeScript',
1135
+ creator: 'Microsoft',
1136
+ creatorUrl: 'https://typescriptlang.org',
1137
+ license: 'Apache-2.0',
1138
+ examples: [
1139
+ {
1140
+ lang: 'typescript',
1141
+ label: 'OpenAI SDK',
1142
+ code: `npm install openai
1143
+
1144
+ import OpenAI from "openai";
1145
+
1146
+ const client = new OpenAI({
1147
+ baseURL: "https://api.hanzo.ai/v1",
1148
+ apiKey: process.env.HANZO_API_KEY,
1149
+ });
1150
+
1151
+ const response = await client.chat.completions.create({
1152
+ model: "zen4-pro",
1153
+ messages: [{ role: "user", content: "Hello!" }],
1154
+ });
1155
+ console.log(response.choices[0].message.content);`,
1156
+ },
1157
+ {
1158
+ lang: 'typescript',
1159
+ label: 'Streaming',
1160
+ code: `const stream = await client.chat.completions.create({
1161
+ model: "zen4-pro",
1162
+ messages: [{ role: "user", content: "Stream this" }],
1163
+ stream: true,
1164
+ });
1165
+
1166
+ for await (const chunk of stream) {
1167
+ process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
1168
+ }`,
1169
+ },
1170
+ {
1171
+ lang: 'typescript',
1172
+ label: 'Next.js route',
1173
+ code: `// app/v1/generate/route.ts
1174
+ import OpenAI from "openai";
1175
+ import { NextResponse } from "next/server";
1176
+
1177
+ const client = new OpenAI({
1178
+ baseURL: "https://api.hanzo.ai/v1",
1179
+ apiKey: process.env.HANZO_API_KEY,
1180
+ });
1181
+
1182
+ export async function POST(req: Request) {
1183
+ const { prompt } = await req.json();
1184
+ const response = await client.chat.completions.create({
1185
+ model: "zen4-pro",
1186
+ messages: [{ role: "user", content: prompt }],
1187
+ });
1188
+ return NextResponse.json(response.choices[0].message);
1189
+ }`,
1190
+ },
1191
+ {
1192
+ lang: 'typescript',
1193
+ label: 'List models',
1194
+ code: `const models = await client.models.list();
1195
+ console.log(\`Available: \${models.data.length} models\`);
1196
+ models.data.slice(0, 5).forEach((m) => console.log(m.id));`,
1197
+ },
1198
+ ],
1199
+ },
1200
+ {
1201
+ slug: 'go',
1202
+ name: 'Go',
1203
+ description: 'Use Hanzo AI in Go using the official OpenAI Go client or any OpenAI-compatible Go library. Hanzo\'s standard REST API works with all HTTP clients.',
1204
+ category: 'language',
1205
+ icon: '🐹',
1206
+ upstream: 'https://github.com/golang/go',
1207
+ creator: 'Go Authors / Google',
1208
+ creatorUrl: 'https://go.dev',
1209
+ license: 'BSD-3-Clause',
1210
+ examples: [
1211
+ {
1212
+ lang: 'go',
1213
+ label: 'OpenAI Go client',
1214
+ code: `go get github.com/openai/openai-go
1215
+
1216
+ package main
1217
+
1218
+ import (
1219
+ "context"
1220
+ "fmt"
1221
+ "github.com/openai/openai-go"
1222
+ "github.com/openai/openai-go/option"
1223
+ )
1224
+
1225
+ func main() {
1226
+ client := openai.NewClient(
1227
+ option.WithBaseURL("https://api.hanzo.ai/v1"),
1228
+ option.WithAPIKey("your-hanzo-api-key"),
1229
+ )
1230
+
1231
+ resp, _ := client.Chat.Completions.New(context.Background(),
1232
+ openai.ChatCompletionNewParams{
1233
+ Model: openai.F("zen4-pro"),
1234
+ Messages: openai.F([]openai.ChatCompletionMessageParamUnion{
1235
+ openai.UserMessage("Hello from Go!"),
1236
+ }),
1237
+ },
1238
+ )
1239
+ fmt.Println(resp.Choices[0].Message.Content)
1240
+ }`,
1241
+ },
1242
+ {
1243
+ lang: 'go',
1244
+ label: 'Raw HTTP client',
1245
+ code: `package main
1246
+
1247
+ import (
1248
+ "bytes"
1249
+ "encoding/json"
1250
+ "fmt"
1251
+ "io"
1252
+ "net/http"
1253
+ "os"
1254
+ )
1255
+
1256
+ func main() {
1257
+ body, _ := json.Marshal(map[string]any{
1258
+ "model": "zen4-pro",
1259
+ "messages": []map[string]string{{"role": "user", "content": "Hello!"}},
1260
+ })
1261
+
1262
+ req, _ := http.NewRequest("POST", "https://api.hanzo.ai/v1/chat/completions", bytes.NewReader(body))
1263
+ req.Header.Set("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
1264
+ req.Header.Set("Content-Type", "application/json")
1265
+
1266
+ resp, _ := http.DefaultClient.Do(req)
1267
+ defer resp.Body.Close()
1268
+ io.Copy(os.Stdout, resp.Body)
1269
+ fmt.Println()
1270
+ }`,
1271
+ },
1272
+ {
1273
+ lang: 'go',
1274
+ label: 'Streaming',
1275
+ code: `stream, _ := client.Chat.Completions.NewStreaming(context.Background(),
1276
+ openai.ChatCompletionNewParams{
1277
+ Model: openai.F("zen4-pro"),
1278
+ Messages: openai.F([]openai.ChatCompletionMessageParamUnion{
1279
+ openai.UserMessage("Write a poem"),
1280
+ }),
1281
+ },
1282
+ )
1283
+ defer stream.Close()
1284
+
1285
+ for stream.Next() {
1286
+ chunk := stream.Current()
1287
+ if len(chunk.Choices) > 0 {
1288
+ fmt.Print(chunk.Choices[0].Delta.Content)
1289
+ }
1290
+ }`,
1291
+ },
1292
+ {
1293
+ lang: 'bash',
1294
+ label: 'Environment',
1295
+ code: `export HANZO_API_KEY="your-hanzo-api-key"
1296
+ go run main.go`,
1297
+ },
1298
+ ],
1299
+ },
1300
+ {
1301
+ slug: 'rust',
1302
+ name: 'Rust',
1303
+ description: 'Use Hanzo AI in Rust via the async-openai crate or raw reqwest HTTP calls. Full async support with Tokio, streaming, and type-safe API access.',
1304
+ category: 'language',
1305
+ icon: '🦀',
1306
+ upstream: 'https://github.com/rust-lang/rust',
1307
+ creator: 'Rust Foundation',
1308
+ creatorUrl: 'https://rust-lang.org',
1309
+ license: 'MIT / Apache-2.0',
1310
+ examples: [
1311
+ {
1312
+ lang: 'toml',
1313
+ label: 'Cargo.toml',
1314
+ code: `[dependencies]
1315
+ async-openai = "0.26"
1316
+ tokio = { version = "1", features = ["full"] }`,
1317
+ },
1318
+ {
1319
+ lang: 'rust',
1320
+ label: 'async-openai',
1321
+ code: `use async_openai::{config::OpenAIConfig, Client, types::*};
1322
+
1323
+ #[tokio::main]
1324
+ async fn main() {
1325
+ let config = OpenAIConfig::new()
1326
+ .with_api_base("https://api.hanzo.ai/v1")
1327
+ .with_api_key(std::env::var("HANZO_API_KEY").unwrap());
1328
+
1329
+ let client = Client::with_config(config);
1330
+
1331
+ let request = CreateChatCompletionRequestArgs::default()
1332
+ .model("zen4-pro")
1333
+ .messages([ChatCompletionRequestUserMessageArgs::default()
1334
+ .content("Hello from Rust!")
1335
+ .build()
1336
+ .unwrap()
1337
+ .into()])
1338
+ .build()
1339
+ .unwrap();
1340
+
1341
+ let response = client.chat().create(request).await.unwrap();
1342
+ println!("{}", response.choices[0].message.content.as_ref().unwrap());
1343
+ }`,
1344
+ },
1345
+ {
1346
+ lang: 'rust',
1347
+ label: 'reqwest raw HTTP',
1348
+ code: `use reqwest::Client;
1349
+ use serde_json::json;
1350
+
1351
+ #[tokio::main]
1352
+ async fn main() {
1353
+ let client = Client::new();
1354
+ let resp = client
1355
+ .post("https://api.hanzo.ai/v1/chat/completions")
1356
+ .bearer_auth(std::env::var("HANZO_API_KEY").unwrap())
1357
+ .json(&json!({
1358
+ "model": "zen4-pro",
1359
+ "messages": [{"role": "user", "content": "Hello!"}]
1360
+ }))
1361
+ .send()
1362
+ .await
1363
+ .unwrap();
1364
+ println!("{}", resp.text().await.unwrap());
1365
+ }`,
1366
+ },
1367
+ {
1368
+ lang: 'bash',
1369
+ label: 'Build and run',
1370
+ code: `export HANZO_API_KEY="your-hanzo-api-key"
1371
+ cargo build --release
1372
+ ./target/release/my-ai-app`,
1373
+ },
1374
+ ],
1375
+ },
1376
+ ];
1377
+ export const INTEGRATION_CATEGORIES = {
1378
+ sdk: 'AI SDKs',
1379
+ framework: 'Frameworks',
1380
+ platform: 'Platforms & Editors',
1381
+ infra: 'Infrastructure',
1382
+ language: 'Languages',
1383
+ };
1384
+ export function getIntegration(slug) {
1385
+ return INTEGRATIONS.find((i) => i.slug === slug);
1386
+ }
1387
+ export function getIntegrationsByCategory(category) {
1388
+ return INTEGRATIONS.filter((i) => i.category === category);
1389
+ }