Page cover

API Guide

Understand how to use Polylith APIs and seamlessly integrate with AI providers like OpenAI, Claude, Gemini, and more to power your workflows.

Polylith offers a unified API to simplify the development of AI workflows and agents. This guide explains how to:

  1. Use Polylith APIs to manage workflows and agents.

  2. Integrate External APIs from AI providers like OpenAI, Anthropic, Google, and more.


1. Polylith API

The Polylith API is your starting point for building and managing workflows.

Base URL

Copy

Copy

plaintextCopy codehttps://api.polylith.dev/v1/

Authentication

Include your Polylith API Key in the header:

Copy

Copy

httpCopy codeAuthorization: Bearer YOUR_POLYLITH_API_KEY

Example: Create an AI Workflow

Copy

Copy


2. External API Providers

Polylith integrates seamlessly with external AI providers via their APIs. Here’s a breakdown of key providers and usage:


OpenAI API

Base URL:

Copy

Copy

Authentication: Use your OpenAI API Key in the header:

Copy

Copy

Request Example: Generating Text with GPT-4

Copy

Copy

Response Example:

Copy

Copy


Anthropic Claude API

Base URL:

Copy

Copy

Authentication: Use your Claude API Key in the x-api-key header:

Copy

Copy

Request Example:

Copy

Copy


Google Gemini API

Base URL:

Copy

Copy

Authentication: Pass the API key in the URL:

Copy

Copy

Request Example: Generating Text

Copy

Copy


3. Combining Providers with Polylith

Polylith’s modular blocks allow you to seamlessly combine these APIs. For example:

Workflow Example: Sending a query to Claude and using the response to post on Discord.

Copy

Copy


4. Key Benefits of Using Polylith with APIs

  • Unified Management: Handle multiple AI provider APIs through Polylith workflows.

  • Ease of Use: No need to write complex API integrations—Polylith simplifies everything.

  • Flexibility: Use providers like OpenAI, Claude, and Gemini based on your project needs.

  • Scalability: Deploy workflows seamlessly across platforms like Discord, Telegram, and Twitter.


Conclusion

Polylith acts as the central hub for managing your AI workflows while integrating effortlessly with external APIs. Whether you’re using OpenAI for text generation, Claude for reasoning, or Gemini for multimodal tasks, Polylith makes development faster and simpler.

Start building today with Polylith and your favorite AI providers.

arrow-up-right

Last updated