1. Make your first request
You need two keys. The SemaCache key (sc-) tells us who you are. The provider key (sk- for OpenAI) is the one we use when the answer is not cached yet.
- 1
Create an account
Open Sign in and choose Sign up. Confirm your email, then sign in. You land on the dashboard.
- 2
Create a SemaCache API key
Go to API Keys and create a key. Copy it once. It starts with
sc-. The dashboard will not show the full key again. - 3
Save your OpenAI key
Go to Settings and add an OpenAI provider key. SemaCache stores it encrypted and uses it only when a request misses the cache. You can also send it on each request as
x-upstream-api-keyinstead of saving it. - 4
Install the OpenAI library and send one prompt
pip install openaifrom openai import OpenAI client = OpenAI( api_key="sc-your-key", base_url="https://www.semacache.io/api/v1", ) response = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "What is the capital of France?"}], ) print(response.choices[0].message.content)Leave out
x-upstream-api-keyif you saved the OpenAI key in Settings. This first call goes to OpenAI, then SemaCache stores the answer.