Quickstart
crypto2api speaks the OpenAI API. If your tool lets you set a base URL, it already works. Here is everything, start to finish.
1. Create a key
Press Create key on the dashboard, or ask the API for one. There is nothing to fill in.
curl -X POST https://api.crypto2api.com/v1/keysThe key is shown once. It is the account: whoever holds it can spend the balance, and nobody, including us, can recover a lost one. Save it before you send money.
2. Add funds
Send USDC or SOL on Solana to the key’s deposit address. The minimum is $5.
- The balance is credited in US dollars a few seconds after the transfer confirms. Deposits of $100 or more wait for the block to be finalized, which takes a little longer.
- USDC is credited at $1.00. SOL is converted at the market rate at the moment it is credited, and that rate is recorded with the deposit.
- Only USDC and SOL, and only on Solana. Other tokens or networks cannot be credited or returned.
- Balances are for using the API. They cannot be withdrawn or refunded.
Check the balance any time:
curl https://api.crypto2api.com/v1/account \
-H "Authorization: Bearer c2a_your_key"3. Make a call
Set the base URL to https://api.crypto2api.com/v1 and use your key as the API key.
from openai import OpenAI
client = OpenAI(
base_url="https://api.crypto2api.com/v1",
api_key="c2a_your_key",
)
reply = client.chat.completions.create(
model="deepseek/deepseek-chat",
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)No money yet? One model is free, up to 50 requests a day per key, with answers of up to 512 tokens:
curl https://api.crypto2api.com/v1/chat/completions \
-H "Authorization: Bearer c2a_your_key" \
-H "Content-Type: application/json" \
-d '{"model": "crypto2api/free", "messages": [{"role": "user", "content": "Hello"}]}'Streaming and tools
Streaming, tool calling, JSON mode and vision work the way they do on OpenAI, on every model that supports them. Pass stream: true and read the events:
stream = client.chat.completions.create(
model="deepseek/deepseek-chat",
messages=[{"role": "user", "content": "Write a haiku about Solana"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Send tools and tool_choice as usual; tool_calls come back in the same shape. The model list marks which models take tools and images.
Models and embeddings
GET https://api.crypto2api.com/v1/models returns every model with its price. It needs no key. Model IDs look like deepseek/deepseek-chat or meta-llama/llama-3.3-70b-instruct.
curl https://api.crypto2api.com/v1/embeddings \
-H "Authorization: Bearer c2a_your_key" \
-H "Content-Type: application/json" \
-d '{"model": "baai/bge-m3", "input": "hello world"}'Billing
- A request costs what the model’s host charges for the tokens used, plus 8%. That is the only fee.
- Before a request runs, the most it could cost is set aside from the balance. When it finishes, the real cost is charged and the rest is returned at once.
- Every response carries the exact charge in
usage.cost, in US dollars. - A balance never goes below zero. If it cannot cover a full answer, the answer is capped at the length it can cover; if it cannot cover the request at all, you get a
402. - A request that fails on our side or the host’s is not charged. A stream you close early is charged for what was generated up to then.
Rate limits
Each key can make 120 requests and use 400,000 tokens a minute, with 8 streams open at once. Responses carry x-ratelimit-remaining-requests and x-ratelimit-remaining-tokens. Over the limit, you get a 429 with a Retry-After header.
Errors
Errors use OpenAI’s shape, so existing clients handle them without changes.
{
"error": {
"message": "Insufficient balance: $0.0000. Send USDC or SOL to this key's deposit address…",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_quota"
}
}| Status | Code | What it means |
|---|---|---|
| 400 | invalid_request_error | Something in the request is wrong. The message says what. |
| 400 | content_policy_violation | The request was blocked by the acceptable use policy. |
| 401 | invalid_api_key | The key is missing, mistyped or does not exist. |
| 401 | account_deactivated | The key was closed for breaking the acceptable use policy. |
| 402 | insufficient_quota | The balance cannot cover this request. Add funds. |
| 403 | unsupported_country_region_territory | The service is not available where the request came from. |
| 404 | model_not_found | No model has that ID. |
| 429 | rate_limit_exceeded | Too fast. Wait for the number of seconds in the Retry-After header. |
| 429 | free_limit_reached | The free model's daily limit is used up. |
| 502 | provider_unavailable | Every host of the model failed. You were not charged. Try again. |