Pomelo

Client Libraries

To make it easier to integrate with our API, we offer client libraries in popular programming languages. These libraries provide convenient methods for accessing our endpoints and handle authentication, request formatting, and error handling for you.

Official Libraries

Python

Our Python client is simple to use and integrates seamlessly with popular Python frameworks.

pip install pomeloapi

JavaScript / Node.js

Our JavaScript library works in both browser and Node.js environments.

npm install pomeloapi

Go

Our Go client library is lightweight and designed for high-performance applications.

go get github.com/pomeloapi/go-client

Rust

Our Rust client library offers memory safety and high performance for system-level applications.

cargo add pomeloapi

Quick Start Examples

Python Example

import ai_console

# Initialize the client with your API key
client = ai_console.Client(api_key="your_api_key")

# Create a completion
response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello, who are you?"}
    ],
    temperature=0.7
)

# Print the response
print(response.choices[0].message.content)

JavaScript Example

import { AIConsole } from 'pomeloapi';

// Initialize the client with your API key
const client = new AIConsole({ apiKey: 'your_api_key' });

async function main() {
  // Create a completion
  const response = await client.chat.completions.create({
    model: 'gpt-3.5-turbo',
    messages: [
      { role: 'system', content: 'You are a helpful assistant.' },
      { role: 'user', content: 'Hello, who are you?' }
    ],
    temperature: 0.7
  });

  // Print the response
  console.log(response.choices[0].message.content);
}

main().catch(console.error);

Image Generation Example

import ai_console

# Initialize the client with your API key
client = ai_console.Client(api_key="your_api_key")

# Generate an image
response = client.images.generate(
    model="flux.1",
    prompt="A futuristic cityscape with flying cars and neon lights",
    n=1,
    size="1024x1024"
)

# Print the image URL
print(response.data[0].url)

Community Libraries

In addition to our official libraries, there are several community-maintained libraries that provide integrations with our API:

LanguageLibraryMaintainerLink
Rubyai_console_rb@ruby_devGitHub
PHPpomeloapi-php@php_developerGitHub
Javapomeloapi-java@java_coderGitHub
C#AIConsole.NET@dotnet_devGitHub

Note: Community libraries are not officially supported or maintained by our team. Please refer to their individual documentation for usage instructions and support.

Building Your Own Client

If you need to integrate our API with a language or framework not covered by our official or community libraries, you can build your own client using our API reference.

Our API follows RESTful principles and uses standard HTTP methods. All endpoints accept and return JSON data. Authentication is handled via API keys passed in the request headers.

Need Help?

If you have questions about using our client libraries or need assistance with integration, our support team is here to help.