OpenAI-compatible API. Change your base URL, keep your code, fund the planet.
EcoRouter is a drop-in replacement for the OpenAI API. If your code works with OpenAI, it works with EcoRouter.
from openai import OpenAI
client = OpenAI(
base_url="https://api.ecorouter.org/v1",
api_key="eco_sk_..." # your EcoRouter API key
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
const resp = await fetch("https://api.ecorouter.org/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer eco_sk_..."
},
body: JSON.stringify({
model: "openai/gpt-4o-mini",
messages: [{"role": "user", "content": "Hello!"}]
})
});
curl https://api.ecorouter.org/v1/chat/completions \
-H "Authorization: Bearer eco_sk_..." \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'
https://api.ecorouter.org/v1Authorization: Bearer eco_sk_...
All requests require an API key passed in the Authorization header. Get your key by signing up via the web UI or the /v1/auth/register endpoint.
Create a new account and get an API key.
| Parameter | Type | Description | |
|---|---|---|---|
| string | required | Your email address | |
| password | string | required | At least 6 characters |
# Request
curl -X POST https://api.ecorouter.org/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "secret123"}'
# Response
{
"api_key": "eco_sk_a1b2c3...",
"deposit_address": "TLqcLi5nz...",
"deposit_hint": "Send any whole dollar amount + $0.042 cents (e.g. $10.042, $25.042)",
"balance_usdt": 0
}
Log in and retrieve your API key.
| Parameter | Type | Description | |
|---|---|---|---|
| string | required | Your email address | |
| password | string | required | Your password |
Generate a chat completion. Fully OpenAI-compatible.
This endpoint proxies directly to OpenRouter with your allocated credit. It supports all standard OpenAI parameters:
| Parameter | Type | Description | |
|---|---|---|---|
| model | string | required | Model ID, e.g. openai/gpt-4o, anthropic/claude-sonnet-4 |
| messages | array | required | Array of message objects with role and content |
| stream | boolean | Stream response as SSE chunks | |
| temperature | number | Sampling temperature (0-2) | |
| max_tokens | integer | Maximum tokens to generate | |
| tools | array | Function calling / tool use definitions |
"stream": true for Server-Sent Events. Works with the OpenAI SDK's stream=True parameter out of the box.
Generate embeddings. Same as OpenAI embeddings API.
List all available models.
EcoRouter routes through OpenRouter, giving you access to 200+ models. Use the full model ID with the provider prefix:
| Model | ID |
|---|---|
| GPT-4o | openai/gpt-4o |
| GPT-4o Mini | openai/gpt-4o-mini |
| GPT-5 | openai/gpt-5 |
| Claude Sonnet 4 | anthropic/claude-sonnet-4 |
| Claude Opus 4 | anthropic/claude-opus-4 |
| Gemini 2.5 Flash | google/gemini-2.5-flash |
| Gemini 2.5 Pro | google/gemini-2.5-pro |
| DeepSeek V3 | deepseek/deepseek-chat |
| DeepSeek R1 | deepseek/deepseek-r1 |
| Llama 4 Maverick | meta-llama/llama-4-maverick |
For the full list, call GET /v1/models or browse openrouter.ai/models.
Check your credit balance and deposit info. Requires Authorization header.
# Response
{
"api_credit_total_usdt": 8.90,
"api_credit_used_usdt": 1.23,
"api_credit_remaining_usdt": 7.67,
"deposit_address": "TLqcLi5nz...",
"deposit_cents_suffix": 42,
"deposit_hint": "Send $X.042 to the deposit address"
}
Send USDT (TRC-20) to the deposit address shown in your balance response. Include your unique cents suffix so we can match the deposit to your account.
For example, if your suffix is 042, send $10.042, $25.042, etc. The deposit is credited automatically within ~60 seconds.
EcoRouter charges the same per-token prices as the underlying providers (via OpenRouter). On top, there's an 11% fee split:
All eco fund transactions are public on the Tron blockchain. See the transparency page for details.
Public endpoint. Returns platform stats, eco wallet address, fund rotation, and donation history. No auth required.