For high-throughput agent loops and backend services that already communicate over gRPC, Dike provides a mirrored gRPC service running on port 9090 (api.dike.it.com:9090).
Rendering diagram...
Service Definition (dike.proto)
Search, Reason, and ReasonStream are three methods on a single DikeService, not separate services:
syntax = "proto3";
package dike.v1;
service DikeService {
rpc Search (SearchRequest) returns (SearchResponse);
rpc Reason (ReasonRequest) returns (ReasonResponse);
rpc ReasonStream (ReasonRequest) returns (stream ReasonStreamChunk);
}
message SearchRequest {
string query = 1;
int32 top_k = 2; // 1-50, default 10
SearchFilters filters = 3;
optional bool rerank = 4; // default true
optional bool include_text = 5; // default true
}
message SearchFilters {
repeated string doc_type = 1; // legislation | case_law | fatwa | regulation | decree
string jurisdiction = 2; // "EG" | "SA"
int32 year_from = 3;
int32 year_to = 4;
repeated string status = 5; // in_force | amended | repealed | unknown
}Authentication & Metadata
Pass your API key in the gRPC call metadata under the authorization header:
authorization: Bearer dike_live_xxxxxxxxxxxxxxxxxxxxxxxxService Discovery with grpcurl
Dike exposes gRPC Server Reflection without authentication for fast inspection:
# List available services
grpcurl api.dike.it.com:9090 list
# Describe DikeService
grpcurl api.dike.it.com:9090 describe dike.v1.DikeService
# Execute a test search
grpcurl -H "authorization: Bearer $DIKE_API_KEY" \
-d '{"query": "مسؤولية الناقل الجوي", "top_k": 3}' \
api.dike.it.com:9090 dike.v1.DikeService/SearchPython gRPC Client Example
import os
import grpc
import proto.dike_pb2 as dike_pb2
import proto.dike_pb2_grpc as dike_pb2_grpc
api_key = os.environ["DIKE_API_KEY"]
# Establish TLS channel
creds = grpc.ssl_channel_credentials()
channel = grpc.secure_channel("api.dike.it.com:9090", creds)
# Metadata auth interceptor
metadata = [("authorization", f"Bearer {api_key}")]
stub = dike_pb2_grpc.DikeServiceStub(channel)
# Execute Request
request = dike_pb2.SearchRequest(
query="مسؤولية الناقل الجوي",
top_k=3,
rerank=True,
filters=dike_pb2.SearchFilters(jurisdiction="EG")
)
response = stub.Search(request, metadata=metadata)
for result in response.results:
print(f"[{result.canonical_id}] {result.title} (Score: {result.score:.3f})")Next Steps
- Explore production deployment recommendations in Production Best Practices.
- Review Rate Limits & Quotas.