Comments (4)
For me, the following setting works. Set the API_KEY
environment, when you have multiple api keys just seperate it with commas, like below :
...
env:
- name: DEBUG
value: "true"
- name: API_KEY
value: "aaa,bbb"
...
Then send request with Authorization http header, value start with Bearer
prefix :
curl --location 'http://localhost:8080/v1/chat/completions' \
--header 'Authorization: Bearer aaa' \
--header 'Content-Type: application/json' \
--data '{
"model": "phi-2",
"messages": [{"role": "user", "content": "how are you?"}],
"temperature": 0.3
}'
I found it in the source code, not document.
from localai.
I see that you're having trouble setting and using the API_KEY
for Nextcloud or HTTP/curl commands in the LocalAI docker-compose setup. As mentioned by @sbe-arg, you can set multiple API keys by separating them with commas in the API_KEY
environment variable. Here's an example from their docker-compose file:
...
env:
- name: DEBUG
value: "true"
- name: API_KEY
value: "aaa,bbb"
...
To send a request with the Authorization header, you must start the value with the Bearer
prefix. Here's an example using curl:
curl --location 'http://localhost:8080/v1/chat/completions' \
--header 'Authorization: Bearer aaa' \
--header 'Content-Type: application/json' \
--data '{"model": "phi-2",
"messages": [{"role": "user", "content": "how are you?"}],
"temperature": 0.3
}'
Regarding the documentation, I understand that you found the information in the source code and not in the official documentation. This is an experiment, and the documentation might not cover all the details yet. You can find more information about this feature in the LocalAI source code ( https://github.com/mudler/LocalAI/blob/main/docs/content/docs/features/openai-functions.md ).
(I am a bot, an experiment of @mudler, and I audited this issue from the LocalAI Github project.)
from localai.
Can I add something like api_keys.json and make local-ai check this file for the keys?
from localai.
related #2046
from localai.
Related Issues (20)
- Can not load tts_models/multilingual TTS models HOT 1
- Error on image generation with diffusers backend on Intel GPU HOT 4
- macbook pro M3 using gpt-4 errors with grpc service not ready
- Missing `/v1/rerank` endpoint in swagger docs
- cannot load model on macos/arm64 due to some backends require LocalAI complied with GO_TAGS HOT 1
- Unable to install or execute any llama3-70B variants HOT 1
- Native windows version? HOT 1
- docs: Offload/stop backend API HOT 7
- Problem with piper
- phi-3-medium-4k-instruct seems to generate jibberish HOT 1
- Autodetect models
- Sign MacOS binaries HOT 3
- CUDA 12.5 support or GPU acceleration not working after graphics driver update HOT 3
- Model loading more than 60x solwer compared to Serge (llama backend)
- Error running make build on local
- llama.cpp cuda detection does not work inside a container
- Failing dependencies in example endpoints/model for image generation HOT 1
- [BUG] setuptools 70.0.0 breaks PyTorch 2.1
- Feature Discussion: Role-Based Auth HOT 2
- The API v1/images/generations do not apply the size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localai.