Getting Started with Swfte Connect: Your AI Gateway in 5 Minutes
Create an API key, make your first request, and understand how Swfte Connect routes AI traffic across providers.
Swfte Connect is a unified AI gateway that sits between your application and every major AI provider. One API key, one OpenAI-compatible endpoint, one billing dashboard -- and you get automatic failover, cost tracking, and model routing across OpenAI, Anthropic, Google, Mistral, and more.
This guide walks you through setup in under five minutes.
Step 1: Create Your API Key
Log in to connect.swfte.com and navigate to the dashboard. Click New API Key in the header, or scroll to the API Keys section.
When creating a key, you can scope it to specific endpoints:
- All Access -- Full access to every endpoint (chat completions, agents, embeddings, images)
- Chat Completions -- Restricted to
/v2/gateway/chat/completions - Agents -- Access to agent-related endpoints only
Give your key a descriptive name like production-backend or dev-testing so you can track usage later.
Important: Copy your API key immediately after creation. It is only shown once. Store it securely -- treat it like a password.
Step 2: Point the OpenAI SDK at Swfte
Swfte Connect is OpenAI-compatible, so you do not need a Swfte-specific package. Use the official openai library (or plain curl) and set the base URL to the Swfte gateway. Put your key in an environment variable:
export SWFTE_API_KEY="sk-swfte-..."
The gateway base URL is https://api.swfte.com/agents/v2/gateway. Authentication is a standard Authorization: Bearer header.
# Python
pip install openai
Step 3: Make Your First Request
The key difference from calling OpenAI directly is the model identifier format: provider:model-name. The free plan can call mini-class models, so the examples use openai:gpt-4o-mini. Premium models need a paid plan and return a 402 tier-limit error on Free.
curl https://api.swfte.com/agents/v2/gateway/chat/completions \
-H "Authorization: Bearer $SWFTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai:gpt-4o-mini",
"messages": [
{"role": "user", "content": "Explain quantum computing in one paragraph."}
],
"max_tokens": 256
}'
Understanding Model Identifiers
Swfte Connect uses a provider:model format to route requests. This gives you explicit control over which provider handles each request:
| Identifier | Provider | Model |
|---|---|---|
openai:gpt-5 | OpenAI | GPT-5 |
anthropic:claude-sonnet-4 | Anthropic | Claude Sonnet 4 |
google:gemini-2.5-pro | Gemini 2.5 Pro | |
mistral:mistral-large | Mistral | Mistral Large |
xai:grok-3 | xAI | Grok 3 |
You can also use just the model name (e.g., gpt-5) and Swfte will route to the appropriate provider automatically.
Step 4: Try the SDK Playground
Before writing integration code, use the built-in SDK Playground on your dashboard. It supports Python, JavaScript, and Java, lets you edit model parameters inline, and shows the full response including latency and token usage.
Click Run to execute the request directly against the gateway. The response appears in the Response tab with timing metadata.
Step 5: Monitor Your Usage
Once requests are flowing, the dashboard updates in real-time:
- Total Tokens -- Aggregate token consumption across all providers
- Responses & Completions -- Request count over time
- Total Costs -- Spend tracking with per-request granularity
- Credit Balance -- Remaining credits with low-balance alerts
Navigate to Insights for deeper analytics: per-model cost breakdowns, latency distributions (p50/p90/p99), provider intelligence, and usage forecasting.
What's Next
Now that you have a working integration, explore these guides:
- Using the OpenAI SDK with Swfte -- Client setup, errors and what the gateway returns
- Multi-Provider Routing -- Set up intelligent routing with automatic failover
- Cost Optimization -- Configure budgets, alerts, and model selection strategies
- API Reference -- Complete REST API documentation
Common Issues
"Invalid API key" error: Make sure you copied the full key including the sk-swfte- prefix. Keys are workspace-scoped, so ensure you are using a key from the correct workspace.
"Model not found" error: Check the model identifier format. Use provider:model-name (e.g., openai:gpt-5, not just gpt-5). Browse available models at connect.swfte.com/connections.
High latency on first request: The first request to a cold provider may take longer. Subsequent requests benefit from connection pooling. For latency-critical applications, consider using provider routing with latency-based selection.