MythIQ

Command Palette

Search for a command to run...

API Parameters

Learn about the common parameters used across the MythIQ API and how to use them effectively.

Overview

The MythIQ API uses a consistent set of parameters across its endpoints to provide a unified experience. This page documents the common parameters that apply to multiple endpoints, while endpoint-specific parameters are documented in their respective sections.

Model-specific Parameters

In addition to the common parameters listed here, each model may support additional parameters specific to its capabilities. For model-specific parameters, please refer to the Models page and select the specific model you're interested in.

Consistent Parameters

MythIQ uses a consistent set of parameters across all endpoints, making it easy to work with different types of AI models through a unified interface.

Common Parameters

These parameters are used across multiple endpoints in the API:

ParameterTypeDescriptionEndpoints
modelstringModel ID or 'base/slug[:version]' format. Specifies which AI model to use./v1/images/generations
/v1/videos/generations
providerstringOptional. Specific provider ID or slug to use for the request./v1/images/generations
/v1/videos/generations
routingstringRouting strategy: 'optimal' (default), 'cheapest', or 'compatible'/v1/images/generations
/v1/videos/generations
promptstringText prompt for generation/v1/images/generations
/v1/videos/generations
sizestringSize of the output (e.g., '1024x1024' for images, '1080p' for videos)/v1/images/generations
/v1/videos/generations
publicbooleanWhether the generated media is public (default: true)/v1/images/generations
/v1/videos/generations
limitintegerMaximum number of items to return (default: 25, max: 100)/v1/media
/v1/models
/v1/providers
pageintegerPage number for pagination (default: 0)/v1/media
/v1/models
/v1/providers

Model Parameter

The model parameter is one of the most important parameters in the API. It specifies which AI model to use for generation.

Format

Models are identified using a consistent format: base/model[:version]

base

The model provider or family (e.g., openai, stability)

model

The specific model name (e.g., dall-e-3, sdxl)

version

Optional. The specific version of the model (e.g., 1.0, 2.1)

Examples

openai/dall-e-3Latest version of OpenAI's DALL-E 3
stability/sdxl:1.0Version 1.0 of Stability AI's SDXL
runway/gen-2Latest version of Runway's Gen-2

Usage

typescript
// Using the model parameter
const response = await openai.images.generate({
  model: 'stability/sdxl',  // Using the latest version of Stability AI's SDXL
  prompt: 'A beautiful sunset over the ocean',
});

// Specifying a specific version
const response = await openai.images.generate({
  model: 'stability/sdxl:1.0',  // Using version 1.0 specifically
  prompt: 'A beautiful sunset over the ocean',
});

Routing Parameter

The routing parameter controls how MythIQ selects a provider for your request. It allows you to optimize for different priorities.

optimal

(default)

Balances cost and feature support. Selects the cheapest provider that supports all requested features, or may choose a slightly more expensive provider (within 20% price difference) if it supports more features.

This is the default strategy and is recommended for most use cases as it provides a good balance between cost and functionality.

cheapest

Always selects the lowest-cost provider that can fulfill the basic requirements of your request. This strategy prioritizes cost savings over additional features or capabilities.

Use this strategy when cost is your primary concern and you don't need advanced features that might only be available from more expensive providers.

compatible

Selects a provider that supports all the parameters you've specified in your request, even if some are optional. This strategy ensures that all features you've requested are supported, even if it means using a more expensive provider.

Use this strategy when you need specific features or capabilities and are willing to pay a premium to ensure they're available.

Usage

typescript
// Using the 'optimal' strategy (default)
const response = await openai.images.generate({
  model: 'stability/sdxl',
  prompt: 'A beautiful sunset over the ocean',
  // routing: 'optimal' is implied
});

// Using the 'cheapest' strategy
const response = await openai.images.generate({
  model: 'stability/sdxl',
  prompt: 'A beautiful sunset over the ocean',
  routing: 'cheapest',
});

// Using the 'compatible' strategy with advanced parameters
const response = await openai.images.generate({
  model: 'stability/sdxl',
  prompt: 'A beautiful sunset over the ocean',
  routing: 'compatible',
  // These advanced parameters will ensure a provider that supports them is selected
  cfg_scale: 10,
  steps: 50,
});

Provider Parameter

The provider parameter allows you to specify a particular provider to use for your request, bypassing the routing system.

Usage

You can specify a provider using its ID or slug:

typescript
// Specifying a provider explicitly
const response = await openai.images.generate({
  model: 'stability/sdxl',
  prompt: 'A beautiful sunset over the ocean',
  provider: 'stability', // Use Stability AI specifically
});

Note on Explicit Provider Selection

When you specify a provider explicitly, the request will fail if that provider is unavailable or doesn't support the requested parameters. Consider using routing strategies for better reliability.

Available Providers

You can get a list of available providers using the /v1/providers endpoint:

bash
curl https://api.mythiq.ai/v1/providers \
  -H "Authorization: Bearer YOUR_API_KEY"

Pagination Parameters

For endpoints that return lists of items, you can use the limit andpage parameters to control pagination.

Usage

typescript
// Fetching the first page with 10 items per page
const response = await fetch('https://api.mythiq.ai/v1/media?limit=10&page=0', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

// Fetching the second page
const response = await fetch('https://api.mythiq.ai/v1/media?limit=10&page=1', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

Response Format

Paginated responses include a total field that indicates the total number of items available:

json
{
  "result": {
    "total": 42,  // Total number of items available
    "medias": [
      // 10 items for the current page
    ]
  },
  "success": true
}