Create a key in the console. Set TOKENPILOT_API_KEY locally, then list the models the key can access. Replace REPLACE_WITH_MODEL_ID in the examples with an ID from that response.
1. Set your key
export TOKENPILOT_API_KEY='replace-with-your-key' # bash / zsh
# PowerShell: $env:TOKENPILOT_API_KEY = 'replace-with-your-key'2. List models
curl "https://api.tokentpilot.com/v1/models" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY"3. Send a request
curl "https://api.tokentpilot.com/v1/chat/completions" \
-H "Authorization: Bearer $TOKENPILOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"REPLACE_WITH_MODEL_ID","messages":[{"role":"user","content":"Reply in one sentence."}]}'Python SDK
python -m pip install openaiimport os
from openai import OpenAI
client = OpenAI(
base_url="https://api.tokentpilot.com/v1",
api_key=os.environ["TOKENPILOT_API_KEY"],
)
reply = client.chat.completions.create(
model="REPLACE_WITH_MODEL_ID",
messages=[{"role": "user", "content": "Say hello."}],
)
print(reply.choices[0].message.content)