Documentation

Complete guide to integrating and using Jinifi AI Gateway

Quick Start

Get started with Jinifi AI Gateway in under 5 minutes. Follow these simple steps to make your first API call.

1. Get Your API Key

Sign up for a free account and get your API key from the dashboard.

2. Install SDK (Optional)

npm install @jinifi/sdk # or pip install jinifi

3. Make Your First Request

Using JavaScript/Node.js:

const Jinifi = require('@jinifi/sdk'); const client = new Jinifi({ apiKey: 'your_api_key_here' }); const response = await client.chat.completions.create({ model: 'gpt-4', messages: [ { role: 'user', content: 'Hello, world!' } ] }); console.log(response.choices[0].message.content);

Using Python:

from jinifi import Jinifi client = Jinifi(api_key="your_api_key_here") response = client.chat.completions.create( model="gpt-4", messages=[ {"role": "user", "content": "Hello, world!"} ] ) print(response.choices[0].message.content)

Using cURL:

curl https://api.jinifi.com/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "messages": [{"role": "user", "content": "Hello!"}] }'
Note: Jinifi is OpenAI-compatible. You can use it as a drop-in replacement by simply changing the base URL to https://api.jinifi.com/v1

Authentication

All API requests require authentication using an API key. Include your key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

You can create and manage API keys from your dashboard.

Security Best Practices

• Never expose your API keys in client-side code or public repositories
• Use environment variables to store API keys
• Rotate keys regularly
• Set up IP allowlisting for production environments
• Use different keys for development and production

Basic Usage

Supported Models

Jinifi supports 100+ AI models from multiple providers. Simply specify the model name:

// OpenAI models model: "gpt-4" model: "gpt-3.5-turbo" // Anthropic models model: "claude-3-opus" model: "claude-3-sonnet" // Google models model: "gemini-pro" model: "gemini-pro-vision" // Meta models model: "llama-3-70b" model: "llama-2-13b"

Intelligent Routing

Enable smart routing to automatically select the best provider based on cost, latency, and availability:

{ "model": "gpt-4", "messages": [...], "routing": { "strategy": "cost-optimized", // or "latency-optimized", "balanced" "fallback": true } }

Rate Limiting

Set custom rate limits to control costs and usage:

{ "model": "gpt-4", "messages": [...], "limits": { "maxTokens": 1000, "maxCostPerRequest": 0.50 } }

API Endpoints

Chat Completions

POST /v1/chat/completions

Generate conversational responses using various AI models.

Completions

POST /v1/completions

Generate text completions for prompts.

Embeddings

POST /v1/embeddings

Generate vector embeddings for text.

Models

GET /v1/models

List all available models and their details.

Pro Tip: Check our interactive API explorer for live examples and testing.

Models

Jinifi provides access to 100+ AI models across multiple providers:

OpenAI: GPT-4, GPT-3.5, GPT-4 Turbo, GPT-4 Vision
Anthropic: Claude 3 Opus, Claude 3 Sonnet, Claude 3 Haiku
Google: Gemini Pro, Gemini Pro Vision, PaLM 2
Meta: Llama 3 (8B, 70B, 405B), Llama 2
Mistral: Mistral Large, Mistral Medium, Mixtral 8x7B
Others: Cohere, AI21, Together AI, and more

View the complete list and real-time pricing in your dashboard.

Parameters

Common Parameters

model (required): Model identifier
messages (required): Array of message objects
temperature: Controls randomness (0-2)
max_tokens: Maximum tokens to generate
top_p: Nucleus sampling threshold
frequency_penalty: Reduces repetition (-2 to 2)
presence_penalty: Encourages new topics (-2 to 2)

Jinifi-Specific Parameters

routing: Intelligent routing configuration
cache: Enable/disable caching
fallback: Automatic fallback configuration
limits: Usage and cost limits
metadata: Custom tracking metadata