Add OpenRouter to inference docs

This commit is contained in:
Abdon Pijpelink
2026-01-22 10:35:34 +01:00
parent ab0cc9955a
commit 21acac2f8d
29 changed files with 665 additions and 1 deletions
@@ -0,0 +1,21 @@
```csharp
using Qdrant.Client;
using Qdrant.Client.Grpc;
var client = new QdrantClient(
host: "xyz-example.qdrant.io",
port: 6334,
https: true,
apiKey: "<your-openrouter-key>"
);
await client.QueryAsync(
collectionName: "{collection_name}",
query: new Document()
{
Model = "openrouter/mistralai/mistral-embed-2312",
Text = "How to bake cookies?",
Options = { ["openrouter-api-key"] = "<YOUR_OPENROUTER_API_KEY>" },
}
);
```
@@ -0,0 +1,27 @@
```go
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
client, err := qdrant.NewClient(&qdrant.Config{
Host: "xyz-example.qdrant.io",
Port: 6334,
APIKey: "<paste-your-openrouter-key-here>",
UseTLS: true,
})
client.Query(context.Background(), &qdrant.QueryPoints{
CollectionName: "{collection_name}",
Query: qdrant.NewQueryNearest(
qdrant.NewVectorInputDocument(&qdrant.Document{
Model: "openrouter/mistralai/mistral-embed-2312",
Text: "How to bake cookies?",
Options: qdrant.NewValueMap(map[string]any{
"openrouter-api-key": "<YOUR_OPENROUTER_API_KEY>",
}),
}),
),
})
```
@@ -0,0 +1,32 @@
```java
import static io.qdrant.client.QueryFactory.nearest;
import static io.qdrant.client.ValueFactory.value;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Points.Document;
import io.qdrant.client.grpc.Points.QueryPoints;
import java.util.Map;
QdrantClient client =
new QdrantClient(
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
.withApiKey("<your-openrouter-key>")
.build());
client
.queryAsync(
QueryPoints.newBuilder()
.setCollectionName("{collection_name}")
.setQuery(
nearest(
Document.newBuilder()
.setModel("openrouter/mistralai/mistral-embed-2312")
.setText("How to bake cookies?")
.putAllOptions(
Map.of(
"openrouter-api-key",
value("<YOUR_OPENROUTER_API_KEY>")
.build()))
.build())
.get();
```
@@ -0,0 +1,20 @@
```python
from qdrant_client import QdrantClient, models
client = QdrantClient(
url="https://xyz-example.qdrant.io:6333",
api_key="<your-api-key>",
cloud_inference=True
)
client.query_points(
collection_name="{collection_name}",
query=models.Document(
text="How to bake cookies?",
model="openrouter/mistralai/mistral-embed-2312",
options={
"openrouter-api-key": "<your_openrouter_api_key>"
}
)
)
```
@@ -0,0 +1,24 @@
```rust
use qdrant_client::{
Qdrant,
qdrant::{Document, Query, QueryPointsBuilder, Value},
};
use std::collections::HashMap;
let client = Qdrant::from_url("<your-qdrant-url>").build().unwrap();
let mut options = HashMap::<String, Value>::new();
options.insert("openrouter-api-key".to_string(), "<YOUR_OPENROUTER_API_KEY>".into());
client
.query(
QueryPointsBuilder::new("{collection_name}")
.query(Query::new_nearest(Document {
text: "How to bake cookies?".into(),
model: "openrouter/mistralai/mistral-embed-2312".into(),
options,
}))
.build(),
)
.await?;
```
@@ -0,0 +1,15 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.query("{collection_name}", {
query: {
text: 'How to bake cookies?',
model: 'openrouter/mistralai/mistral-embed-2312',
options: {
'openrouter-api-key': '<your_openrouter_api_key>'
},
},
});
```